def commaSpiltList(self, listData): listData = list(listData) strs = str(listData[0]) for letter in range(1, len(listData) - 1): strs = strs + ',' + str(listData[letter]) strs += ',' + str(listData[len(listData) - 1]) print(strs)
#!/usr/bin/python# -*- coding: UTF-8 -*- L = [1,2,3,4,5]s1 = ','.join(str(n) for n in L)print s1