Logo

Programming-Idioms

History of Idiom 53 > diff from v7 to v8

Edit summary for version 8 by :

Version 7

2015-08-21, 23:25:07

Version 8

2015-08-21, 23:25:37

Idiom #53 Join a list of strings

Concatenate elements of string list x joined by the separator ", " to create a single string y.

Idiom #53 Join a list of strings

Concatenate elements of string list x joined by the separator ", " to create a single string y.

Code
y = ", ".join(x)
Code
y = ", ".join(x)
Comments bubble
This works only if x contains only strings.
Comments bubble
This works only if x contains only strings.
Doc URL
https://docs.python.org/3/library/stdtypes.html#str.join
Origin
https://docs.python.org/3/library/stdtypes.html#str.join