我对Python很陌生。我在做数组的时候被这部分打动了。你知道吗
这是代码:
with open("top10backup.txt", "r") as filestream:
count=0
for line in filestream:
currentline = line.split("\t")
print(currentline[0])
category[count] = currentline[0]
print(currentline[1])
source[count] = currentline[1]
count = count + 1
print (count)
我得到一个错误:
category[count] = currentline[0]
Inconsistent use of tabs and spaces in indentation
有人能解释一下吗?你知道吗
在Python中,空格用于表示不同的代码块,因此当您混合使用纯空格和制表符字符时,这会让人困惑,因为Python不确定一个制表符应该包含多少空格。如果找到所有选项卡并将它们转换为空格(确保保留正确的缩进),那么代码就可以正常运行。你知道吗
相关问题 更多 >
编程相关推荐