Python obtient le nom de fichier depuis le chemin
import os
print(os.path.basename(your_path))
Itchy Ibis
import os
print(os.path.basename(your_path))
import os
files_and_directories = os.listdir("path/to/directory")
import os
infile = "./../../../../_data/matrix_data/5mer_normalized.tsv"
print(os.path.basename(infile))
>>> "5mer_normalized.tsv"
filename = os.path.basename("path/to/file/sample.txt")
print (os.path.basename("/path/to/file.txt"))
# file.txt