da***@yahoo.com wrote:
Does someone have the Python code to pull just the filename and
extension from the end of an absolute path please.
Thanks in advance ...
# Here you go...
import os.path
# Example path
p1 = "C:\\WINDOWS\\system32\\DirectX\\Dinput\\mse.i ni"
# This will return: 'mse.ini'
os.path.basename(p1)
"""
You can read more about manipulating file paths by reading the Python
documentation under "6.2 os.path -- Common pathname manipulations".
DA
"""