空格混用
python有些东西还是挺麻烦的,就比如我写了一个极其简单的程序,结果有一个错误提示
users=["li xiao yu","zhuang dui dui","zhang song song","hu er","admin"]
if users:
for user in users:
if user=="admin":
print("Hello admin, would you like to see a status report.")
else:
print("Hello "+user.title()+" !")
else:
print("We need to find some users!")
del users[-5:]
if users:
for user in users:
print("Hello "+user.title()+" !")
else:
print("We need to find some users!")
上网查了下资料,并且用Notepad++显示了一下空格
显然是因为tab和空格键混用了
虽然我比较懵(因为我写代码的时候并没有使用tab键),不过为了方便,以后写程序的时候,我会尽量都用tab键,这样可以减少出错