--道心
>>> name_list=[‘daoxin‘,‘wuxin‘]
>>> name_list[0]
‘daoxin‘
>>> name_list[1]
‘wuxin‘
>>> name_list[-1]
‘wuxin‘
>>>name="daoin,wuxin"
>>> name.split(‘,‘)
[‘daoin‘, ‘wuxin‘]
>>> name_list=[‘daoxin‘,‘wuxin‘]
>>> name_list.append(‘123‘)
>>> name_list
[‘daoxin‘, ‘wuxin‘, ‘123‘]
>>> id(name_list)
760600272392
>>> name_list=[‘daoxin‘,‘wuxin‘,‘tony‘]
>>> name_list
[‘daoxin‘, ‘wuxin‘, ‘tony‘]
>>> del name_list[2]
>>> name_list
>>> len(name_list)
2
>>> "_".join(name_list)
‘daoxin_wuxin‘
>>> "wuxin" in name_list
True
[
"daoxin",("seven","wuxin")
]
#str,list,tuple相同点:切片,索引(-1),len(),包含,循环,
str
#(字符串)修改后,重新开辟空间
list
#(列表)修改后,不变
tuple
#(元祖)不允许修改
原文:http://www.cnblogs.com/DaoXin-WXR/p/6269003.html