1 问题 在使用命令行运行python文件时,出现以下错误: TabError: Inconsistent use of tabs and spaces in indentation 但是代码什么的都没有问题,最后发现是格式的问题。因为python中默认是使用缩进进行区分代码的,所以如果使用了tab键进行缩进代码,那就回报这个错误。 2 解决方法 用空格代替tab即可。