python - Python 中的列表

标签 python list

python中的List是同构的还是异构的?

最佳答案

>>> def a(): pass
>>> lst=[1,'one',{1:'one'},a,[1,1],(1,),True,set((1,))]
>>> for each in lst:
...    print type(each), str(each)
... 
<type 'int'> 1
<type 'str'> one
<type 'dict'> {1: 'one'}
<type 'function'> <function a at 0x100496938>
<type 'list'> [1, 1]
<type 'tuple'> (1,)
<type 'bool'> True
<type 'set'> set([1])

有什么问题吗?

关于python - Python 中的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5150958/

相关文章:

python - xml 属性/标签中的 unicode 字符无效

python - 如何使用Python正确复制 ".xlsx"文件

r - R 中的 SAS 宏变量

Android - 拖放 - 列表重新排列

Python追加: It only return the last value repeatedly

python - Django Admin - 禁用 FK 字段更新

python - while 循环中的一行代码只执行一次

python - 与 association_proxy 的双向关系

python - 如何使用 python 更新 sqlite 表,其中列表中的值?

python - 列表突然改变了,即使我没有改变它