【问题标题】:i want to create a file with the person's name, how can i get no errors?我想用这个人的名字创建一个文件,我怎样才能没有错误?
【发布时间】:2021-04-29 20:04:24
【问题描述】:

我听不懂,它说“扩展 'cogs.money' 引发错误:IndentationError: unindent does not match any external indentation level (money.py, line 26)”

@commands.command()
        async def money(self, ctx, member):
            #how do i get the people who message, name

        open(member, '.txt', 'a').close()

      if os.stat(member, '.txt').st_size == 0:
          moneyfile=open(member, '.txt', 'w')
          moneyfile.write('40')
          moneyfile.close()
      else:
        readfile=open(member, '.txt', 'r').read()
        points=readfile
        int(points)
        await ctx.send(points)

【问题讨论】:

  • 错误与您的代码有关。您没有正确缩进。

标签: python discord discord.py


【解决方案1】:

错误准确地说明了问题所在。您的代码导致缩进错误。修正第 26 行的间距,该错误就会消失。

"Extension 'cogs.money' raised an error: IndentationError: unindent does not match any outer indentation level (money.py, line 26)"

【讨论】:

    猜你喜欢
    • 2017-08-11
    • 2021-10-30
    • 2011-04-27
    • 2017-07-06
    • 2022-10-24
    • 2017-07-01
    • 2021-07-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多