0 votes
in Python by
Why do we use join() function in Python?

1 Answer

0 votes
by

The join() is defined as a string method which returns a string value. It is concatenated with the elements of an iterable. It provides a flexible way to concatenate the strings. See an example below.

Example:

  1. str = "Rohan"  
  2. str2 = "ab"  
  3. # Calling function    
  4. str2 = str.join(str2)    
  5. # Displaying result    
  6. print(str2)  

Output:

aRohanb

Related questions

0 votes
asked Oct 11, 2021 in Python by rajeshsharma
0 votes
asked Jul 20, 2020 in JSON by Robindeniel
...