concat next line with previous

Ben Finney bignose+hates-spam at
Thu Sep 28 02:09:40 CEST 2006

tobiah <toby at> 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