Python 的数据类型

时间:2023-03-09 19:47:33
Python 的数据类型

列表    

#coding=utf-8
students=["小明","小华","小李","小娟","小云"]print students[3]students[3]="小月"print students[3]

#元祖,元祖的内容不能修改students=("小明","小华","小李","小娟","小云")students[1]="小月"print students[1]

#集合a=set("abcslkdddjflk")b=set("cfm")#交集x=a&bprint x

#并集y=a|bprint y

#差集z=a-bprint z

#去除重复元素new=set(a)print new

#字典
#coding=utf-8k={"姓名:":"典韦","籍贯":"桂林"}print k["籍贯"]

#添加字典里面的项目k["爱好"]="音乐"print k["姓名"]print k["爱好"]