Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53956
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: How can I remove the first line of a multi-line string? (SOLVED) |
| Date | 2013-09-11 08:42 -0400 |
| References | <5224B786.2050606@gmail.com> <CAMw+j7Lp8v49qqSsq9TzevxNz1jWs=rNNbhYdF8NmPfYSi82GA@mail.gmail.com> <mailman.500.1378139057.19984.python-list@python.org> <roy-581C0C.13071102092013@news.panix.com> <CAA=1kxS7Y2FhcuWsUXnT-z_TyHj-iQPhePehjCt+2oMOFo=xSw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.245.1378903390.5461.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: How can I remove the first line of a multi-line string? (SOLVED) Anthony Papillion <papillion@gmail.com> - 2013-09-02 11:24 -0500
Re: How can I remove the first line of a multi-line string? (SOLVED) Roy Smith <roy@panix.com> - 2013-09-02 13:07 -0400
Re: How can I remove the first line of a multi-line string? (SOLVED) Fábio Santos <fabiosantosart@gmail.com> - 2013-09-11 13:08 +0100
Re: How can I remove the first line of a multi-line string? (SOLVED) Roy Smith <roy@panix.com> - 2013-09-11 09:03 -0400
Re: How can I remove the first line of a multi-line string? (SOLVED) Terry Reedy <tjreedy@udel.edu> - 2013-09-11 08:42 -0400
csiph-web