discord.py - if 语句中的缩进错误 | 不和谐.py
问题描述
await ctx.send('Enter the channel name you want to be set as default welcome channel: ')
else:
await ctx.send('Only server moderators and owner can use this command')
代码给了我错误:IndentationError: expected an indented block
解决方案
该错误不是 DiscordError 子类。
这只是一个缩进错误。
这意味着您的代码没有很好地缩进。
例子
>>> if (True):
print('True')
IndentationError raised
您必须缩进语句块:
>>> if (True):
print('True')
'True'
没有任何问题。
综上所述
如果您的错误仅仅是因为错误的缩进,请修复它并接受我的回答。推荐阅读
- r - R:为数据框生成动态名称
- javascript - Tabulator: Download Error - No such download type found
- autodesk-forge - 在 Autodesk.Viewing.Viewer3D 中显示上下文菜单
- timeout - 逻辑应用程序 Web 挂钩到黑板 API 超时错误
- kotlin - 如何转换流
流动 - > 在科特林?
- json - 将 Json 字段从 SQL 返回到 ASP.NET Core API
- html - 为什么即使我指定了 DL 标签的宽度,它也会使用所有空间?
- c# - 如何将字符串转换为类型?
- json - Swift:将字典转换为 JSON 以用于多部分/表单数据
- c# - 我可以使用 Accord.Net 进行并发 cobyla 优化吗?