One thing at a time all the time!

Welcome to Rocteur
Thursday, April 25 2024 @ 06:14 AM CEST

How do you get the last portion of a variable containing "/"

pe="http://www.rtve.es/mediateca/videos/20100211/saber-comer---patatas-castellanas-costillas-11-02-10/691046.shtml"

In [2]: import os

In [3]: os.path.basename(pe)
Out[3]: '691046.shtml'

JM
--
http://mail.python.org/mailman/listinfo/python-list

basename(p)
Returns the final component of a pathname

FAQ Manager » python » How do you get the last portion of a variable containing "/"