How to Join Strings in Python

Python’s built-in string method .join() lets you combine string elements from an iterable into a single string, using a separator that you specify. You call .join() on the separator, passing the iterable of strings to join.

By the end of this tutorial, you’ll understand that:

  • You use .join() in Python to combine string elements with a specified separator.
  • A separator is the piece of text you want inserted between each substring.
  • To join list elements, you call .join() on a separator string, passing the list as the argument.
  • .join() inserts the separator between each list element to form a single string.
  • The .join() method returns a new string that is the concatenation of the elements in the iterable, separated

     

     

     

    To finish reading, please visit source site