Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Created July 28, 2020 13:41
Show Gist options
  • Save FerdinaKusumah/f3a4da16798cff31b27e3971fac3a644 to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/f3a4da16798cff31b27e3971fac3a644 to your computer and use it in GitHub Desktop.
[Python] merge list
"""Merge list"""
"""string list"""
words = ["a", "b", "c", "d"]
print(f'merge string list is {",".join(words)}')
# merge string list is a,b,c,d
"""number list"""
number = [1, 2, 3, 4, 5, 6]
print(f'merge number list is {",".join(map(str, number))}')
# merge number list is 1,2,3,4,5,6
"""mix list"""
mix = [1, 2, "a", "b", "c", True, False, 2.0, 3.0000]
print(f'merge mix list is {",".join(map(str, mix))}')
# merge mix list is 1,2,a,b,c,True,False,2.0,3.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment