python: ()&[ ]

来源:互联网 发布:java 集合框架详解 编辑:程序博客网 时间:2024/05/29 14:45

python中,某函数名后面加‘()’,而某数据类型后面加‘[ ]’
比如,

>>> a=range(5)>>> a[0, 1, 2, 3, 4]>>> a[1]1>>> a(1)Traceback (most recent call last):  File "<pyshell#37>", line 1, in <module>    a(1)TypeError: 'list' object is not callable
0 0