Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Last active December 5, 2019 01:51
Show Gist options
  • Save FerdinaKusumah/c92d88e8acbe18621dad529eaba1978a to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/c92d88e8acbe18621dad529eaba1978a to your computer and use it in GitHub Desktop.
Create comma separated from list
"""List string"""
a = ["a", "b", "c", "d"]
string_separated = ",".join(a)
print("Join string from list to {}".format(string_separated))
# Join string from list to a,b,c,d
"""List Number"""
b = [1, 2, 3, 4, 5]
number_separated = ",".join(map(str, b))
print("Join number from list to {}".format(number_separated))
# Join number from list to 1,2,3,4,5
"""List Mix"""
c = [1, "python", 3, "awesome", 5]
mix_separated = ",".join(map(str, c))
print("Join mix from list to {}".format(mix_separated))
# Join mix from list to 1,python,3,awesome,5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment