#!/usr/bin/python3

#列表 是可变的,可修改的
listDemo = ["one","two","three","four","five"]
print("type(listDemo): %r"%type(listDemo))
print("listDemo = %r"%listDemo) print("listDemo[1]:"+listDemo[1]) print("insert列表")
listDemo.insert(0,"insert")
print("listDemo = %r"%listDemo) print("update列表")
listDemo[0]= "update"
print("listDemo = %r"%listDemo) print("delete列表")
del listDemo[0]
print("listDemo = %r"%listDemo) #list函数
print("len(listDemo) %r"%(len(listDemo))) print("max(listDemo) %r"%(max(listDemo))) print("min(listDemo) %r"%(min(listDemo))) listDemo.sort()
print("listDemo.sort() %r"%(listDemo)) #list.copy() 复制
#删除
#list.pop(index)
#list.remove(value)

Python:列表的更多相关文章

  1. python 列表排序

    转自http://www.iplaypython.com/jinjie/jj114.html reverse()方法 将列表中元素反转排序,比如下面这样>>> x = [1,5,2, ...

  2. python列表、元祖、字典

    python列表   ['a','1','vs2']       里面的值可以改 python元祖   ('a','1','css','sdf12')   里面的值不能改 python字典   {'s ...

  3. Python列表、元组、字典和字符串的常用函数

    Python列表.元组.字典和字符串的常用函数 一.列表方法 1.ls.extend(object) 向列表ls中插入object中的每个元素,object可以是字符串,元组和列表(字符串“abc”中 ...

  4. Python 列表

    python 列表 列表的特点 1.列表是一种可变的数据类型,这点是跟元组有区别的 2.列表中的值是有序的,并且可存放重复的值,这点跟set有区别的 3.python中的列表类似于其它语言中的数组 4 ...

  5. python 列表生成器

    python 列表生成器 列表生成式即List Comprehensions,是Python内置的非常简单却强大的可以用来创建list的生成式. 一个循环 在C语言等其他语言中,for循环一般是这样的 ...

  6. [转载] Python 列表(list)、字典(dict)、字符串(string)常用基本操作小结

    创建列表 sample_list = ['a',1,('a','b')] Python 列表操作 sample_list = ['a','b',0,1,3] 得到列表中的某一个值 value_star ...

  7. Python 列表如何获得一个指定元素所在的下标

    在使用Python3.4读取txt数据到列表,由于编码问题,读取到的数据通常会出现'\ufeffX'(x为你想要的数据).这时候如果需要把列表中的数据由字符串转换到数值型的数据的进行数据分析的话就会出 ...

  8. python列表的常用操作方法

    主要介绍了Python中列表(List)的详解操作方法,包含创建.访问.更新.删除.其它操作等,需要的朋友可以参考下. 1.创建列表.只要把逗号分隔的不同的数据项使用方括号括起来即可 List = [ ...

  9. !!对python列表学习整理列表及数组详细介绍

    1.Python的数组分三种类型:(详细见 http://blog.sina.com.cn/s/blog_6b783cbd0100q2ba.html) (1) list 普通的链表,初始化后可以通过特 ...

  10. (转载)Python 列表(list)操作

    (转载)http://blog.csdn.net/facevoid/article/details/5338048 创建列表sample_list = ['a',1,('a','b')] Python ...

随机推荐

  1. python三元运算符

    在c.php里面,都有三元运算符,如:   a = b?c:d 意思是 b 的运算结果如果是True,那么整个表达式a就等于c,反之如果b的运算结果是False,那么a就等于d. 这样写起来简洁又高效 ...

  2. HDOJ/HDU 1113 Word Amalgamation(字典顺序~Map)

    Problem Description In millions of newspapers across the United States there is a word game called J ...

  3. What is happening in Crockford's object creation technique?

    What is happening in Crockford's object creation technique? http://stackoverflow.com/questions/27660 ...

  4. 初识jQuery,八字真言“选择元素,对其操作”

    jQuery在我印象中,就是很多类似$(),然后昨天开始接触了,觉得很和谐,获取元素比JavaScript简单很多,有意思. 一.开始学习jQuery,下载jQuery库的文件 http://jque ...

  5. Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5

    Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of ...

  6. [每日一题] OCP1z0-047 :2013-08-12 view视图的描述哪些是正确的?

    正确答案是: CE 这是OCP教材中的: 1.简单视图与复杂视图的定义: 2.复杂视图通常不能被DML: .WITH CHECKOP TIONT选项 A不正确.简单视图可以被更新. hr@OCM> ...

  7. android账号与同步之同步实现

    上一篇博文我先介绍了账号与同步的账号管理,这篇就介绍一下还有一部分.就是android给提供的sync同步机制的使用. 事实上sync机制的使用和上一篇博文中介绍的账号管理非常类似,也是基于binde ...

  8. [Ionic] Ionic Quickstart for Windows

    1. Install ionic 2. Create ionic app ionic start myApp tabs //create a app cd myApp ionic serve // o ...

  9. Android实战技巧之六:PreferenceActivity使用详解

    一.写作前面 当我们做应用的时候,需要用户配置一些信息,而这就是通常所说的应用设置. 对于Android系统来说,系统本身的设置带来的用户体验和习惯已经深入人心,在我们的应用中同样用到类似的设置页, ...

  10. Cocos2d-x中获取设备语言的方法

    1.cocos2dx获取设备语言的方法:CCApplication::sharedApplication()->getCurrentLanguage() 2.cocos2dx 2.1.4支持识别 ...