所以目前我有两个字符串,我将它们转换为列表并通过使用这些函数将它们转换为集合来比较它们。
def add_compare(File1, File2):
d = set(File1.splitlines())
e = set(File2.splitlines())
a = list(e - d)
return a
def remove_compare(File1, File2):
d = set(File1.splitlines())
e = set(File2.splitlines())
a = list(d - e)
return a
added = add_compare(f1, f2)
removed = remove_compare(f1, f2)
这就是我遇到的错误。
Traceback (most recent call last):
File "/home/container/.local/lib/python3.9/site-packages/discord/ext/tasks/__init__.py", line 239, in _loop
await self.coro(*args, **kwargs)
File "/home/container/main.py", line 100, in uS
added = await add_compare(f1, f2)
File "/home/container/main.py", line 66, in add_compare
a = list(e - d)
TypeError: unsupported operand type(s) for -: 'coroutine' and 'coroutine'
我在 MyClient(commands.Bot) 中使用 discord.py。直到我将其更改为 commands.Bot,它才中断。它曾经是 discord.Client。不确定此更改是否是导致它中断的原因。那么我如何让它再次返回一个列表而不是协程呢?