how can I list only file names in a directory without directory info in the result? I tried
for file in glob.glob(dir+filetype): print file give me result /path_name/1.log,/path_name/2.log,.... but what I do need is file name only: 1.log, 2.log, etc. I do not need the directory info in the result. is there a simple way to get rid of the path info? I don't want to some substr on the result. Thank you!
diris a built-in function,dir(). You should choose another variable name in case any of your modules use the function, as it could lead to confusing bugs.fileeither, as it's the name of a builtin type (and therefore also callable as a function, which works just likeopen).