concat next line with previous
tobiah
toby at tobiah.org
Wed Sep 27 12:20:37 EDT 2006
s99999999s2003 at yahoo.com wrote:
> hi
> what is the python way to concat 2 lines eg
>
> line 1 with some text
> line 2 with some text
>
> i want to bring line 2 up , such that i get one whole string.
>
> line 1 with some text line 2 with some text
>
assuming that the 'lines' have newlines at the end,
maybe:
' '.join(line1[:-1], line2)
or
' '.join(line.replace('\n', ''), line2)
Which covers the case of no newline at the end as well.
--
Posted via a free Usenet account from http://www.teranews.com
More information about the Python-list
mailing list