python add items in list code example
Example 1: how to append list in python
list1 = ["hello"]
list1 = list1 + ["world"]
Example 2: how can I add all the element of list of word in python?
l = ['aaa', 'bbb', 'ccc']
s = ''.join(l)
print(s)
# aaabbbccc
s = ','.join(l)
print(s)
# aaa,bbb,ccc
s = '-'.join(l)
print(s)
# aaa-bbb-ccc
s = '\n'.join(l)
print(s)
# aaa
# bbb
# ccc