Copyright © tutorialspoint.com

Python String join() Method

previous next


Description:

This method returns a string in which the string elements of sequence have been joined by str separator.

Syntax:

str.join(sequence)

Parameters:

Here is the detail of parameters:

Return Value:

It returns a string which is the concatenation of the strings in the sequence seq. The separator between elements is the string providing this method.

Example:

#!/usr/bin/python

str = "-";
seq = ("a", "b", "c"); # This is sequence of strings.
print str.join( seq );

This will produce following result:

a-b-c

previous next

Copyright © tutorialspoint.com