列表转换字符串

#方法一
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))
 
 
#方法二
num_list1 = [0,1,2,3,4,5,6,7,8,9]
num_list_new1 = map(lambda x:str(x), num_list1)
print (",".join(num_list_new1))
 
 
 
 

猜你喜欢

转载自www.cnblogs.com/dearddu/p/12457158.html
今日推荐