how to print comma separated list in python

how to print comma separated list in python

in this article we'll learn how to print comma separated list in python.

syntax


','.join(your_list)

example


#list
array = ['morocco', 'france', 'italy', 'japan', 'spain']

#print list with comma
join = ','.join(array)

#print
print(join)


output

morocco,france,italy,japan,spain