Python 将列表中的元素转化为字符串

colors = ['red', 'blue', 'yellow', 12, 3.14] str1 = str(colors)[1:-1] str1 >> "'red', 'blue', 'yellow', 12, 3.14" 这种方式,会将每个元素拼到字符串中,从另外一个角度看,他只是把中括号替换成了引号。python colors = ['red', 'blue', 'yellow'] s
相关文章
相关标签/搜索