我想讀取文件並執行下面的一些字符串函數。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