【发布时间】:2022-01-14 17:33:17
【问题描述】:
a = raw_input("What do you want to add to the list?"
" If you would like to remove something from the list type 'remove' : ")
if str(a) not == "remove".lower():
print('"'), str(a), ('"' " has been added to list")
list1.append(a)
print(list1)
当我运行它时(有更多代码,但这是相关位)它在“if str(a) not == "remove".lower(): “ 线。请记住,这是在 python 2.7 上
【问题讨论】:
-
语法错误。使用
!=而不是not ==。这在基本教程中都有介绍。
标签: python-2.7