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


Groups > comp.lang.python > #16350 > unrolled thread

remove characters before last occurance of "."

Started byplsullivan1@gmail.com
First post2011-11-28 12:24 -0800
Last post2011-11-28 13:13 -0800
Articles 5 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  remove characters before last occurance of "." plsullivan1@gmail.com - 2011-11-28 12:24 -0800
    Re: remove characters before last occurance of "." Ethan Furman <ethan@stoneleaf.us> - 2011-11-28 12:45 -0800
    Re: remove characters before last occurance of "." Arnaud Delobelle <arnodel@gmail.com> - 2011-11-28 21:08 +0000
      Re: remove characters before last occurance of "." plsullivan1@gmail.com - 2011-11-28 13:13 -0800
      Re: remove characters before last occurance of "." plsullivan1@gmail.com - 2011-11-28 13:13 -0800

#16350 — remove characters before last occurance of "."

Fromplsullivan1@gmail.com
Date2011-11-28 12:24 -0800
Subjectremove characters before last occurance of "."
Message-ID<9707115.134.1322511872642.JavaMail.geo-discussion-forums@yqeu24>
I need for GIS.GIS.Cadastral\GIS.GIS.Citylimit to be Citylimit. The "cadastral" and "citylimit" will be different as I readlines from a list. In other words, the above could be GIS.GIS.Restricted\GIS.GIS.Pipeline and I would need Pipeline.

s = GIS.GIS.Cadastral\GIS.GIS.Citylimit
NeededValue = Citylimit

Thanks.

[toc] | [next] | [standalone]


#16354

FromEthan Furman <ethan@stoneleaf.us>
Date2011-11-28 12:45 -0800
Message-ID<mailman.3107.1322514133.27778.python-list@python.org>
In reply to#16350
plsullivan1@gmail.com wrote:
> s = GIS.GIS.Cadastral\GIS.GIS.Citylimit
> NeededValue = Citylimit

NeededValue = s.rsplit('.', 1)[1]

~Ethan~

[toc] | [prev] | [next] | [standalone]


#16355

FromArnaud Delobelle <arnodel@gmail.com>
Date2011-11-28 21:08 +0000
Message-ID<mailman.3108.1322514511.27778.python-list@python.org>
In reply to#16350
On 28 November 2011 20:45, Ethan Furman <ethan@stoneleaf.us> wrote:
> plsullivan1@gmail.com wrote:
>>
>> s = GIS.GIS.Cadastral\GIS.GIS.Citylimit
>> NeededValue = Citylimit
>
> NeededValue = s.rsplit('.', 1)[1]

Also:

>>> s[s.rfind(".") + 1:]
'Citylimit'
>>> s.rpartition(".")[2]
'Citylimit'

-- 
Arnaud

[toc] | [prev] | [next] | [standalone]


#16357

Fromplsullivan1@gmail.com
Date2011-11-28 13:13 -0800
Message-ID<mailman.3109.1322514828.27778.python-list@python.org>
In reply to#16355
Thanks!

[toc] | [prev] | [next] | [standalone]


#16358

Fromplsullivan1@gmail.com
Date2011-11-28 13:13 -0800
Message-ID<28260178.222.1322514824753.JavaMail.geo-discussion-forums@yqi26>
In reply to#16355
Thanks!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web