Last active
December 5, 2019 01:51
-
-
Save FerdinaKusumah/c92d88e8acbe18621dad529eaba1978a to your computer and use it in GitHub Desktop.
Create comma separated from list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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