我想读取文件并执行下面的一些字符串函数。Python 3.3:打印中的TabError
ins = open("data.txt", "r")
for line in ins:
category = (line.split("/"))[0]
print (category)
ins.close()
然而,错误信息如下所示:
File "C:\Python33\parsing_food.py", line 4
print (category)
^
TabError: inconsistent use of tabs and spaces in indentation
如何解决这个问题?
我想用“/”字符拆分字符串并打印返回数组中的第一个字符串。
您是否尝试确保您的源代码仅使用空格或制表符? –
其语法错误 – MONTYHS
Ignacio Vazquez-Abrams,你对,我修好了! – user3217766