【发布时间】:2019-10-29 11:14:24
【问题描述】:
我收到 SyntaxError:f-string: empty expression not allowed 我不确定(完全)这是什么意思
我尝试移动代码并在网上查看,但没有得到不同的结果
代码是:
@client.command()
async def load(ctx, extension):
client.load_extension(f'cogs.{extension}')
await ctx.send(f"Loaded the {} module!".format(extension))
这是用于齿轮的,我确定其他一切都正确,但我不确定
如果有人知道该怎么做,请告诉我,谢谢
【问题讨论】:
-
使用
f'...'或.format(..)不要同时使用:f"Loaded the {} module!".format(extension))。 -
现在 Python 控制台甚至不想打开,它打开一瞬间然后关闭(我可以看到这是一个回溯错误,但仅此而已,它使用 IDLE 控制台打开,但我喜欢用 Python 的)
-
用cmd提示符和终端打开并运行(运行后不会关闭)。这是一个不同的问题。
标签: python python-3.x discord.py-rewrite