lst=['hello','景大佩',98,'hello']print(lst,index('hello'))所写程序如上,但是出现报错:print(lst,index('hello'))NameError: name 'index' is not defined。请问怎么解决?
lst后面应该是 . 点你写成逗号了
lst=['hello','景大佩',98,'hello'] print(lst.index('hello'))