75

python列表基本语法-pengwei59的博客-51CTO博客

 6 years ago
source link: http://blog.51cto.com/13543767/2065646
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
1、列表可以存放任何数据类型,元素可以重复,可以嵌套列表。可以对之进行增删改查操作。2、创建列表:L=【】或L=list()创建一个空列表;3、查询或者取值:ex:L=【1,2,3,“a”,“b”,“c”,1,1】通过索引或者下标取值,从左往右下标从0开始,从右往左从-1开始。L【0】=1,L【-1】=“c”。4、查找元素的索引值:查找b的索引值:L.index(“b”)=4,如果有重复的元素,则

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK