Answers for "seperate string in the list by comma in python"

5

python list comma separated string

hobbies = ["basketball", "football", "swimming"]
print("My hobbies are:")      	# My hobbies are:
print(", ".join(hobbies)) 		# basketball, football, swimming
Posted by: Guest on February-16-2021
0

how to write elements of a list as a string with a comma between elements in python

a_list = ["a", "b", "c"]
joined_string = ",". join(a_list) #Concatenate elements of `a_list` delimited by `","`
print(joined_string)
#output - a,b,c
Posted by: Guest on January-12-2022

Code answers related to "seperate string in the list by comma in python"

Python Answers by Framework

Browse Popular Code Answers by Language