热线电话:13121318867

登录
首页精彩阅读python创建列表并给列表赋初始值的方法
python创建列表并给列表赋初始值的方法
2018-03-19
收藏

python创建列表并给列表赋初始值的方法

这篇文章主要介绍了python创建列表并给列表赋初始值的方法,涉及Python列表的定义与赋值技巧分享给大家供大家参考。


具体如下:    
aList = [123, 'abc', 4.56, ['inner', 'list'], 7-9j]
anotherList = [None, 'something to see here']
print aList
print anotherList
aListThatStartedEmpty = []
print aListThatStartedEmpty
print list('foo')

运行结果如下:    
[123, 'abc', 4.56, ['inner', 'list'], (7-9j)]
[None, 'something to see here']
[]
['f', 'o', 'o']

希望本文所述对大家的Python程序设计有所帮助。

数据分析咨询请扫描二维码

若不方便扫码,搜微信号:CDAshujufenxi

最新资讯
更多
客服在线
立即咨询