Python data type sequence--list
**列表**list是处理一组有序项目的数据结构,即你可以在一个列表中存储一个序列的项目。列表是可变类型的数据。用[]表示列表,包含了多个以逗号分割开的数字或者字符串。
>>>List1 = [' 1 ',' Chen ',' Chen ']>>>List2 = [1,2,3,4]>>>LIST3 = ["STR1","STR1","a"]>>>LIST4 = []>>>LIST5 = [' Chen ', -,"Male"]>>>list5[1] = +>>>list5[' Chen ', +,' Male ']>>>ID (LIST5)4429403272>>>list5[1] = +>>>ID (LIST5)4429403272>>>LIST5 = [' ch ',1,' Female ']>>>ID (LIST5)4429403416>>>list5[3] =' 1234 'Traceback (most recent): File"<stdin>", line1,inch<module>indexerror:list Assignment index out of range>>>List5.append (' 1234 ')>>>list5[' ch ',1,' Female ',' 1234 ']>>>List5.append (' ll ')>>>List5.append (' 1234 ')>>>list5[' ch ',1,' Female ',' 1234 ',' ll ',' 1234 ']>>>List5.remove (' 1234 ')>>>list5[' ch ',1,' Female ',' ll ',' 1234 ']>>>List5.remove (' 1234 ')>>>list5[' ch ',1,' Female ',' ll ']>>>List5.remove (list5[3])>>>list5[' ch ',1,' Female ']>>>Help (List.append)>>>Help (list)>>>list5[' ch ',1,' Female ']>>>del(list5[1])>>>list5[' ch ',' Female ']
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Python data type sequence--list