I've been struggling for the past 2 days to do something that I am sure is easy. Unfortunately I do not know python very well (nearly nothing actually) and I'm just trying to edit a script for work.
Basically it should look into a folder, get the filename and assign the filename to a variable. But everything I tried failed :
filepath = "/folder/*.*/"
for path in glob.glob(filepath):
dirname, filename = os.path.split(path)
print(filename)[0:-19]
var1 = filename
var2 = filename[0:-25]
I tried with
var1 = str(filename)
But nothing works. Any advice would be greatly appreciated!
[0:-19]and[0:-25]. Without it I manage to get all filenames present in all matching folders (easily editable to save the names into variables). If it's what you want, I can put the answer.