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


Groups > comp.lang.python > #45431

Re: spilt question

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <fabiosantosart@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.034
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'string': 0.09; 'underscore': 0.09; 'subject:question': 0.10; 'cc:addr:python- list': 0.11; 'argument.': 0.16; 'wrote:': 0.18; 'split': 0.19; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'appreciated': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'work.': 0.31; 'url:python': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'should': 0.36; 'skip:& 10': 0.38; 'url:mail': 0.40; 'skip:y 20': 0.60; 'to:addr:gmail.com': 0.65; 'limit': 0.70; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=uJfpIN7TyNAF3oD3P5bL4ZL6Zc3pTAgjZwIpwZ6sJtU=; b=CVxaD6iGauet0KsqY1ffI8ym5Bj86FrkBkbOheWucTkxubQG8euJAnLDL75YCTeSj/ qNZms2nCb/ChzEOOUmoE/Sv54niVDjSSm+ZR9ZjkY9zi0RT46TMzP8r0LpvQIxscZJNp Zjl6ayOO/Nope/tAvlXum4McftePdHsuKtiBixpWVruw8G4jLbRLq2099E0kmvtw0G9a iKNbzQGOW7TiCF9rHNRtYtZMNxFtitJ3+ZEv13Hp34bK3eDYyp/XiouKBZFSJe8XER1N sLY20iJi7c1oqN5c/3yf294QhtZw00ymjjdqfRiPLmELq55WSdaMkXKSE5JHs+D3Sfic GR5w==
MIME-Version 1.0
X-Received by 10.229.135.10 with SMTP id l10mr13644840qct.82.1368717267268; Thu, 16 May 2013 08:14:27 -0700 (PDT)
In-Reply-To <d8c03de0-dc35-45e3-a6b2-2af39feb9e79@googlegroups.com>
References <d8c03de0-dc35-45e3-a6b2-2af39feb9e79@googlegroups.com>
Date Thu, 16 May 2013 16:14:27 +0100
Subject Re: spilt question
From Fábio Santos <fabiosantosart@gmail.com>
To loial <jldunn2000@gmail.com>
Content-Type multipart/alternative; boundary=00248c7690aa83a0ec04dcd752ba
Cc python-list@python.org
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1756.1368717275.3114.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1368717276 news.xs4all.nl 15984 [2001:888:2000:d::a6]:34996
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45431

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

str.split takes a limit argument. Try your_string.split('_', 1)
On 16 May 2013 16:11, "loial" <jldunn2000@gmail.com> wrote:

> I want to split a string so that I always return everything BEFORE the
> LAST underscore
>
> HELLO_xxxxxxxx.lst         # should return HELLO
> HELLO_GOODBYE_xxxxxxxx.ls  # should return HELLO_GOODBYE
>
> I have tried with rsplit but cannot get it to work.
>
> Any help appreciated
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

spilt question loial <jldunn2000@gmail.com> - 2013-05-16 08:00 -0700
  Re: spilt question Walter Hurry <walterhurry@lavabit.com> - 2013-05-16 15:10 +0000
  Re: spilt question Fábio Santos <fabiosantosart@gmail.com> - 2013-05-16 16:14 +0100
  Re: spilt question Chris Angelico <rosuav@gmail.com> - 2013-05-17 01:15 +1000
  Re: spilt question Dave Angel <davea@davea.name> - 2013-05-16 11:20 -0400
  Re: spilt question Tim Chase <python.list@tim.thechases.com> - 2013-05-16 10:23 -0500
  Re: spilt question Ned Batchelder <ned@nedbatchelder.com> - 2013-05-16 11:22 -0400
  Re: spilt question Dave Angel <davea@davea.name> - 2013-05-16 11:32 -0400

csiph-web