Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

join

  • join
fruits = ['apple', 'banana', 'peach', 'kiwi']

together = ':'.join(fruits)
print(together) # apple:banana:peach:kiwi

together = ' '.join(fruits)
print(together) # apple banana peach kiwi

mixed = ' -=<> '.join(fruits)
print(mixed) # apple -=<> banana -=<> peach -=<> kiwi

another = ''.join(fruits)
print(another)  # applebananapeachkiwi

csv = ','.join(fruits)
print(csv) # apple,banana,peach,kiwi
  • For real CSV use: csv