1 a = 10 2 s = str(a) 3 print(type(s)) 4 print('转化后:',s) 5 a = [1,2,3,4,5,6,7,8,9] 6 #将列表中每一个元素转化为字符串 7 L = map(str,a) 8 print(list(L)) 9 print(type(L))
1 <class 'str'> 2 转化后: 10 3 ['1', '2', '3', '4', '5', '6', '7', '8', '9'] 4 <class 'map'>