Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
python file from path 1

python file from path

April 23, 2022 by Anurag batra
import os
print(os.path.basename(your_path))

Here is what the above code is Doing:
1. Importing the os module.
2. Using the os.path.basename() function to get the filename from the path.
3. Printing the filename.

Categories Python Examples
Post navigation
pandas add dataframe to the bottom of another
how to set the screen brightness using python
© MyEduKit - 2022 . All Rights Reserved.