,".join(a_list)
如果list中不是字符串,而是数字,则不能使用如上的方法,会有如下的错误:
TypeError: sequence item 0: expected string, int...found
可以有以下的两种方法:
1、
num_list = [0,1,2,3,4,5,6,7,8,9]
num_list_new = [str(x) for x in num_list]
print...",".join(num_list_new)
2、
num_list = [0,1,2,3,4,5,6,7,8,9]
num_list_new = map(lambda x:str(x), num_list