faqts : Computers : Programming : Languages : Python : Common Problems : Strings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 5 people (20%) answered Yes
Recently 1 of 5 people (20%) answered Yes

Entry

How do i concatenate a list of words with intervening occurrences of more than one single space

May 10th, 2006 15:40
stephen brown, chempaka biru,


The string method join() will let you join a list with any
intervening string:
>>> a = "a list of words".split()
>>> a
['a', 'list', 'of', 'words']
>>> "   ".join(a)
'a   list   of   words'
>>>