python错误大全

    1、NameError:name 'Ture' is not defined
        这个是名字没有定义,也可能写错了
        while True:
    2、IndentationError: unindent does not match any outer indentation level
        这个是因为没有在行首输入,是因为有空格。
    3、OSError: [Errno 22] Invalid argument: 'd:x01.txt'
        主要原因是读取文件内容时出现错误,主要是由于文件路径出错。
        代码为:with open('d:1.txt') as f:
                          print(f.read())
        解决方法:with open('d:/1.txt') as f:  把路径变成/就可以解决问题.
原文地址:https://www.cnblogs.com/wang50902/p/11661881.html