list、str、int 转换
1. list 数据开始
list --> str
alist = ["a", "b", "c"]
"".join(alist) # "abc"
list --> int
strlist = ['1', '2', '3']
''.join(strlist) # '123'
int(''.join(strlist)) # 123
numlist = [1, 2, 3]
strlist2 = [str(x) for x in numlist] # ['1', '2', '3']
# 或者 list(map(str, numlist)) 输出['1', '2', '3']
int(''.join(strlist2)) # 123
2. str 数据开始
str --> int
strA = '123'
int(strA) # 123
str --> list
strA = '123'
list(strA) # ['1', '2', '3']
3. int 数据开始
int --> str
a = 123
str(a) # '123'
int --> list
a = 123
list(str(a)) # ['1', '2', '3']
list(map(int, str(a))) # [1, 2, 3]