concat next line with previous

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Sep 27 20:09:40 EDT 2006


tobiah <toby at tobiah.org> writes:

> assuming that the 'lines' have newlines at the end,

No need to assume; tell the string what you want.

    ' '.join(line1.rstrip('\n'), line2)

-- 
 \       "Nothing is so common as to imitate one's enemies, and to use |
  `\        their weapons."  -- Voltaire, _Dictionnaire Philosophique_ |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list