How can I remove the first line of a multi-line string? (SOLVED)

Terry Reedy tjreedy at udel.edu
Wed Sep 11 08:42:54 EDT 2013


On 9/11/2013 8:08 AM, Fábio Santos wrote:

> Is there not a limit argument to str.split? This should be trivial.

Yes, I posted an example using it the first day.

I also showed how to use iter and next with files and avoid copying.

> first, rest = multiline_str.split('\n', 1)

This does not work right is there is no '\n'

Then someone pointed out
first, dummy, rest = partition('\n')
which does work with no '\n'

-- 
Terry Jan Reedy





More information about the Python-list mailing list