Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53956

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; 'subject:How': 0.10; 'jan': 0.12; 'posted': 0.15; 'copying.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:remove': 0.16; 'wrote:': 0.18; 'pointed': 0.19; 'example': 0.22; 'header :User-Agent:1': 0.23; 'first,': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'rest': 0.29; 'am,': 0.29; 'subject:the': 0.34; 'there': 0.35; 'next': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'files': 0.38; 'does': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'received:173': 0.61; 'first': 0.61; 'day.': 0.63; 'limit': 0.70; 'received:fios.verizon.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: How can I remove the first line of a multi-line string? (SOLVED)
Date Wed, 11 Sep 2013 08:42:54 -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>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
In-Reply-To <CAA=1kxS7Y2FhcuWsUXnT-z_TyHj-iQPhePehjCt+2oMOFo=xSw@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.245.1378903390.5461.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1378903390 news.xs4all.nl 15890 [2001:888:2000:d::a6]:58330
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53956

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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