1、列表操作
b=["青岛","烟台","济南"]
print(b)
b.reverse()
print(b[0])
print("济南" in b)
b.append("德州")
print(b)
b.insert(3,"潍坊")
print(b)
b.sort()
print(b)
2、元组操作:元组即只读列表
tap = (2,3,4)
print(tap)
3、字典操作
dict={"abc":10,4:"115a"}
for value in dict.values():
print(value)
for key in dict.keys():
value = 0
value = dict[key]
print(value)
print(dict["abc"])
4、字符串操作
squeue = "QUE stu best best best!" #squeue是字符串
list = squeue.split() #list是字符数组
dict = {} #dict是字典
for a in list:
if a in dict:
dict[a]+=1
else:
dict[a]=1
print(dict)
name = "123 456"
print(name)
print(name[4:6])
akk = name + "999"
print(akk)
5、时间函数
import time
print time.localtime()
localtime = time.asctime(time.localtime())
print(localtime)
print time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())