Python erhalten Sie den Namen der Datei
file_name = os.path.basename(file_path)
SkullLi
file_name = os.path.basename(file_path)
>>> list_of_names_in_directory = os.listdir('path/of/directory')
>>> f = open('/tmp/generic.png','r')
>>> f.name
'/tmp/generic.png'
>>> import os
>>> os.path.basename(f.name)
'generic.png'
filesName = list(map(os.path.basename, glob.glob("..\yourPath\*txt")))
print(filesName)
>>> f = open('/tmp/generic.png','r')
>>> f.name
'/tmp/generic.png'
>>> import os
>>> os.path.basename(f.name)
'generic.png'