手机
当前位置:查字典教程网 >脚本专栏 >python >python创建列表并给列表赋初始值的方法
python创建列表并给列表赋初始值的方法
摘要:本文实例讲述了python创建列表并给列表赋初始值的方法。分享给大家供大家参考。具体如下:aList=[123,'abc',4.56,['i...

本文实例讲述了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程序设计有所帮助。

【python创建列表并给列表赋初始值的方法】相关文章:

python回调函数的使用方法

python基础教程之lambda表达式使用方法

python爬取网站数据保存使用的方法

python 动态获取当前运行的类名和函数名的方法

python实现跨文件全局变量的方法

Python生成pdf文件的方法

Python编写检测数据库SA用户的方法

python正则表达式修复网站文章字体不统一的解决方法

python中文乱码的解决方法

python操作日期和时间的方法

精品推荐
分类导航