【发布时间】:2020-04-15 17:55:06
【问题描述】:
我正在构建一个不和谐的机器人,它将与人类打牌。问题是当我尝试加载 JSON 文件时,程序不起作用。
`@bot.command(pass_context=True)
async def loadCards(ctx):
with open('wcards.json') as f:
wtcards = json.load(f)
with open('bcards.json') as f:
bkcards = json.load(f)
if len(wtcards) > 1 and len(bkcards) > 1:
await ctx.send('Cards Loaded')`
【问题讨论】:
-
你能比“它不起作用”更具体吗?你有错误吗?输出是什么?
-
它说'str'对象没有属性'read'
标签: python-3.7 discord.py