python 中如何将列表中的数值转换为字符串
作者:互联网
001、
>>> test1 = ["aaa", 100, 200] >>> test1 ['aaa', 100, 200] >>> test2 = [str(k) for k in test1] ## 将列表test1中的数值转换为字符串 >>> test2 ['aaa', '100', '200']
002、
>>> test1 = ("aaa", 100, 200) >>> test1 ('aaa', 100, 200) >>> test2 = [str(k) for k in test1] ## 同样适用于元组 >>> test2 ['aaa', '100', '200'] >>> tuple(test2) ('aaa', '100', '200')
标签:test1,200,test2,aaa,python,列表,str,字符串,100 来源: https://www.cnblogs.com/liujiaxin2018/p/16597486.html