You can find the name of a file in Python using several methods. Here are three common methods:
os module:main.py134 chars6 lines
main.py120 chars4 lines
pathlib module (Python 3.4 and above):main.py142 chars6 lines
All three methods will return the name of the file with its extension.
gistlibby LogSnag