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,列表,字符串,100 From: https://www.cnblogs.com/liujiaxin2018/p/16597486.html