remove characters before last occurance of "."

Arnaud Delobelle arnodel at gmail.com
Mon Nov 28 16:08:29 EST 2011


On 28 November 2011 20:45, Ethan Furman <ethan at stoneleaf.us> wrote:
> plsullivan1 at 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



More information about the Python-list mailing list