转字符 str()
a = 10res = str(a)# '10'
转数字 int()
a = "520"b = int(a)# 520a = 520.99b = int(a)# 520
转浮点数 float()
a = "520"b = float(a)# 520.0a = 520b = float(a)# 520.0
字符转数组 list()
temp = 'nihaoshijie'temp = list(temp)# 打印 ['n', 'i', 'h', 'a', 'o', 's', 'h', 'i', 'j', 'i', 'e']
元祖转数组 list()
temp = (1,2,3,4,5,6)temp = list(temp)# 打印 [1, 2, 3, 4, 5, 6]
 
