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:]) -- https://mail.python.org/mailman/listinfo/python-list