Python学习

来源:互联网 发布:camera软件下载 编辑:程序博客网 时间:2024/06/09 17:10

Python——List(1)

Python学习这里只加上例子

cast=["a",1,"b",2,"c",3,"d",4]print len(cast)cast.append("e")print len(cast)print castcast.extend(["f","g"])print castcast.remove("a")print castcast.insert(0,"z")print castfor i in cast:print(i)cnt=0#attention the originwhile cnt<len(cast):#attention the operator ':'!!!print(cast[cnt])cnt = cnt+1#python don't have the check for the check-error#so ,the check for cast[100] will get a mistake


1 0
原创粉丝点击