Crossin的编程教室

标题: list索引不显示 [打印本页]

作者: 08ms_xxy    时间: 2018-1-8 09:45
标题: list索引不显示
l = [365, 'everyday', 0.618, True]
print (l)[1]


[365, 'everyday', 0.618, True]
Traceback (most recent call last):
  File "F:/python3.4/Lib/idlelib/26.py", line 2, in <module>
    print (l)[1]
TypeError: 'NoneType' object is not subscriptable

上面是代码,下面是显示,萌新不会python,3的语法怎么码,能显示365?




作者: 08ms_xxy    时间: 2018-1-8 10:00
哦。。是print(l[1])是吧。。




欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/) Powered by Discuz! X2.5