Regular expression
Andre Müller
gbs.deadeye at gmail.com
Wed Jul 26 08:09:45 EDT 2017
More information about the Python-list mailing list
Wed Jul 26 08:09:45 EDT 2017
- Previous message (by thread): Regular expression
- Next message (by thread): Regular expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
fname = 'first-324-True-rms-kjhg-Meterc639.html'
# with string manipulation
stem, suffix = fname.rsplit('.', 1)
print(stem[-4:])
# oo-style with str manipulation
import pathlib
path = pathlib.Path(fname)
print(path.stem[-4:])
- Previous message (by thread): Regular expression
- Next message (by thread): Regular expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list