Nov-17-2020, 04:54 AM
What is the difference between these 2?
1. with os.sep.join([dirpath, filename])
1. with os.sep.join([dirpath, filename])
for (dirpath, dirnames, filenames) in os.walk(path):
for filename in filenames:
if filename.endswith('.jpg'):
list_of_files[filename] = os.sep.join([dirpath, filename])2. os.path.join(dirpath, filename)for (dirpath, dirnames, filenames) in os.walk(path):
for filename in filenames:
if filename.endswith('.jpg'):
list_of_files[filename] = os.path.join(dirpath, filename)Both seem to produce the same result. Is either preferable??
