列表(Lists)
序列是Python中最基本的数据结构,序列中的每个元素都分配一个数字,它的第一个索引是0第二个索引是1,依次类推。
列表是最常用的Python数据类型,它可以作为一个方括号内的逗号分隔值出现。
例子:
#coding=utf-8
#!/usr/bin/python
student=['uu','bb','qq','ww']
print (student[0])
print (student[1:3])
print (student[-1]) #访问最后一个元素
print (student[3])
 
student.append('xx') #末尾追加元素
print (student)
 
student.insert(1,'nn') #置顶位置添加元素
print (student)
 
student[0]='LL' #修改元素
print (student)
 
student.pop() #末尾删除元素
print (student)
 
student.pop(0) #删除指定位置的元素
print (student)
 

最新文章

  1. codevs2178 表达式运算Cuties[笛卡尔树]
  2. JavaScript 装逼指南
  3. LR工具使用之场景设置
  4. NC WebService接口开发流程
  5. 推荐一款系统软件:Unity tweak tool
  6. jQuery deferred when用法
  7. hdu 4856 Tunnels (bfs + 状压dp)
  8. oracle 过程函数,包的区别和联系
  9. nodemon 或者 Supervisor 监控 Express4.x的代码改动
  10. MySQL实用基础笔记
  11. 使用jQuery的hover事件在IE中不停闪动的解决方法
  12. Python之编写登陆接口
  13. linux 下启动java jar包 shell
  14. Python(字符编码)
  15. js 奇偶判断
  16. 用Java实现MVPtree——MVPtree点集内去重以及衍生出来的多维向量Hash问题
  17. jquery鼠标放上去显示悬浮层即弹出定位的div层
  18. 【ibatis】IBatis的SQL批量操作
  19. 【WPF】右键菜单ContextMenu可点击区域太小的问题
  20. easyui treegrid idField 所在属性中值有花括号(如Guid)当有鼠标事件时会报错,行记录一下

热门文章

  1. SpringBoot:Shiro 整合 Redis
  2. mysql 优化配置和方面
  3. ffmpeg直播系统
  4. 吴裕雄--天生自然Android开发学习:1.2.1 使用Eclipse + ADT + SDK开发Android APP
  5. NEON优化之《简介》
  6. 3DMAX卸载/完美解决安装失败/如何彻底卸载清除干净3DMAX各种残留注册表和文件的方法
  7. leetcode 1.回文数-(easy)
  8. 控制webbrowser滚动到指定位置
  9. php--0与空的判断
  10. spring 任务调度quartz