Created
January 11, 2019 14:26
-
-
Save travis23/80ded409196b5e5fc1bf28c9a7153139 to your computer and use it in GitHub Desktop.
[get filename from path] #python #filename #ntpath #path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See | |
# https://stackoverflow.com/questions/8384737/extract-file-name-from-path-no-matter-what-the-os-path-format | |
import ntpath | |
path_to_file = r"C:\a\b\s\d\f_a\aasdas_o_g.json" | |
print(ntpath.basename(path_to_file) | |
# Output: | |
# aasdas_o_g.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment