Variable type: value change, but the same id, proof is changing the original, is a variable type
Immutable type: value change, but id also followed changes, proof is produced in a new value is immutable
Digital Type
Plastic int
age = 10 #age=int(10)
Float float
float("1.2")
res = str([1,2,4]) # 转为字符串
+ Common operations built-in method
1. Press the index value
2. Section --msg [0: 3: 1]
msg[-1:-12:-1]
msg[::-1]
3. The length --len ()
4. strip()——";;egon/;;;".strip('/;')
strip () can be used to remove the blank
5. split ( "*") - somehow be delimited string list
6. * .jion () -. ':' Join (list) element connection list
7. list()——list({'a':1, 'b':2})
res = list({'a':1, 'b':2})
res = ['a','b']
List of operations
# 成员运算in和not in
l=['a','b','c','d','e']
print('a' in l)
# 追加与insert
l=['a','b','c','d','e']
l.append('xxx')
l.append('yyy')
print(l)
l.insert(0,'xxxx')
print(l)
# 删除
l=['a','bbb','c','d','e']
# del是一种通用的删除操作,没有返回值
del l[0]
print(l)
dic={'k1':1}
del dic['k1']
print(dic)
# l.remove(指定要删除的那个元素),没有返回值
res=l.remove('bbb')
print(l)
print(res)
# l.pop(指定要删除的那个元素的索引),返回刚刚删掉的那个元素
l=['a','bbb','c','d','e']
l.pop(-1)
res=l.pop(1)
print(l)
print(res)