Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92051
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <larry.martell@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'issue?': 0.09; 'output': 0.15; 'thu,': 0.15; 'subject:Regular': 0.16; 'wrote:': 0.16; 'string': 0.17; 'case.': 0.18; 'all,': 0.20; 'skip:" 30': 0.20; 'to:name:python-list@python.org': 0.20; 'fix': 0.21; 'am,': 0.23; '2015': 0.23; 'split': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.28; 'fine': 0.29; 'problem': 0.33; 'received:google.com': 0.34; 'to:addr:python-list': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'to:addr:python.org': 0.39; '9:36': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=VpmdntA0O3uFUFUso7kbNH3VcIK8877hv6/VG/8jGFM=; b=wnqsZBocEcmQ1bUVqQ25qajIb3hu5FG+Umpc7JUkZREfU1V3SgbNANoZld0sbFtPwo cGebtY730b4P1GeEetLNqwd7yMd4mXhg/Vjfd6Fx+tq/isakMfYh9xIddEU1umg3qNLP mnXKyvnqfOCXnTwTH0naf0NydduGI8Xx+h1ytzIfGCdEEq8cQjE3wodp+Zu7jIXQUkCe qkn5wyeC/sCROWl64yFHq3OFjBFAz1hRpSkuKI15zErk4xPhsPGRn3uu4rWLRE2GVb/l HtHbQLxIVnIsg5ysJxC+rUWKHXOXJA0lDV+zE/PznIYloBMVJv7zEQQ+F1Eh8jSnuvbS mpwg== |
| MIME-Version | 1.0 |
| X-Received | by 10.194.235.100 with SMTP id ul4mr7535825wjc.33.1433425439215; Thu, 04 Jun 2015 06:43:59 -0700 (PDT) |
| In-Reply-To | <c85bc324-37fe-469e-b3b1-b1d4e51bf7d8@googlegroups.com> |
| References | <c85bc324-37fe-469e-b3b1-b1d4e51bf7d8@googlegroups.com> |
| Date | Thu, 4 Jun 2015 09:43:59 -0400 |
| Subject | Re: Regular Expression |
| From | Larry Martell <larry.martell@gmail.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| 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.160.1433425441.13271.python-list@python.org> (permalink) |
| Lines | 12 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1433425441 news.xs4all.nl 2844 [2001:888:2000:d::a6]:44796 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:92051 |
Show key headers only | View raw
On Thu, Jun 4, 2015 at 9:36 AM, Palpandi <palpandi111@gmail.com> wrote:
>
> Hi All,
>
> This is the case. To split "string2" from "string1_string2" I am using
> re.split('_', "string1_string2", 1)[1].
>
> It is working fine for string "string1_string2" and output as "string2". But actually the problem is that if a sting is "__string1_string2" and the output is "_string1_string2". It is wrong.
>
> How to fix this issue?
"__string1_string2".split('_')[-1]
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Regular Expression Palpandi <palpandi111@gmail.com> - 2015-06-04 06:36 -0700 Re: Regular Expression Larry Martell <larry.martell@gmail.com> - 2015-06-04 09:43 -0400 Re: Regular Expression Steven D'Aprano <steve@pearwood.info> - 2015-06-04 23:54 +1000 Re: Regular Expression Tim Chase <python.list@tim.thechases.com> - 2015-06-04 08:48 -0500 Re: Regular Expression Peter Otten <__peter__@web.de> - 2015-06-04 16:00 +0200 Re: Regular Expression Laura Creighton <lac@openend.se> - 2015-06-04 16:21 +0200
csiph-web