Python List数据的遍历
2016-11-21 13:35
337 查看
Python List数据的遍历
方式一:
输出: 1234 5677 8899
方式二:
输出: 0 1234 1 5677 2 8899
方式三: 使用range()或xrange()
输出: 0 1234 1 5677 2 8899
方式四: 使用iter()
输出: 1234 5677 8899
Python List数据的遍历
收藏
雪之丞
发表于 2年前
阅读 16923
收藏 5
点赞 2
评论 0
摘要: python 遍历list
方式一:
输出: 1234 5677 8899
方式二:
输出: 0 1234 1 5677 2 8899
方式三: 使用range()或xrange()
输出: 0 1234 1 5677 2 8899
方式四: 使用iter()
输出: 1234 5677 8899
方式一:
<!-- lang: python --> app_list = [1234, 5677, 8899] <!-- lang: python --> for app_id in app_list: <!-- lang: python --> print app_id
输出: 1234 5677 8899
方式二:
<!-- lang: python --> app_list = [1234, 5677, 8899] <!-- lang: python --> for index,app_id in enumerate(app_list): <!-- lang: python --> print index, app_id
输出: 0 1234 1 5677 2 8899
方式三: 使用range()或xrange()
<!-- lang: python --> app_list = [1234, 5677, 8899] <!-- lang: python --> for i in range(len(app_list)): <!-- lang: python --> print i,app_list[i]
输出: 0 1234 1 5677 2 8899
方式四: 使用iter()
<!-- lang: python --> app_list = [1234, 5677, 8899] <!-- lang: python --> for app_id in iter(app_list): <!-- lang: python --> print app_id
输出: 1234 5677 8899
Python List数据的遍历
收藏
雪之丞
发表于 2年前
阅读 16923
收藏 5
点赞 2
评论 0
摘要: python 遍历list
方式一:
<!-- lang: python --> app_list = [1234, 5677, 8899] <!-- lang: python --> for app_id in app_list: <!-- lang: python --> print app_id
输出: 1234 5677 8899
方式二:
<!-- lang: python --> app_list = [1234, 5677, 8899] <!-- lang: python --> for index,app_id in enumerate(app_list): <!-- lang: python --> print index, app_id
输出: 0 1234 1 5677 2 8899
方式三: 使用range()或xrange()
<!-- lang: python --> app_list = [1234, 5677, 8899] <!-- lang: python --> for i in range(len(app_list)): <!-- lang: python --> print i,app_list[i]
输出: 0 1234 1 5677 2 8899
方式四: 使用iter()
<!-- lang: python --> app_list = [1234, 5677, 8899] <!-- lang: python --> for app_id in iter(app_list): <!-- lang: python --> print app_id
输出: 1234 5677 8899
相关文章推荐
- Python 打印嵌套list中每个数据(遍历列表)
- python基本数据类型list,tuple,set,dict用法以及遍历方法
- python学习笔记--打印嵌套list中每个数据(遍历列表)
- Python的list循环遍历中,删除数据的正确方法
- Play Framework常用标签list,set,如何遍历list、map类型数据
- Python 实现QC Test Plan 数据遍历
- python中列表(list)和字典(dict)数据排序
- List、Set及Map的读取数据---Iterator遍历
- 给予POI机制的把Excel文件导入Oracle,数据全部读入list,然后遍历list插入oracle
- struts2中从数据库中读取数据,并在JSP页面中遍历保存有JavaBean对象的List对象
- Python学习入门基础教程(learning Python)--6 Python下的list数据类型
- 列表(list)和字典(dict)数据排序 Python
- python 内建数据类型 列表(list)
- python 将复杂数据类型(list、dict)存储到文件 以及 读入 pickle模块
- python中遍历出所有字典数据
- Python内置数据类型之List篇
- Python多维/嵌套字典数据无限遍历
- Datalist中定位到所操作控件的那一条数据、遍历整个DataList,遍历CheckBoxList 控件
- Python 列表 list 数据类型创建list、添加元素和删除元素
- Python tricks(3) -- list和dict的遍历和方法