Dec-25-2022, 07:38 PM
Hello,
possible blueprint:
Make
Once the dict is complete, you can iterate over the dict looking for values with a length > 1.
To iterate over a directory, you may want to use the newer / nicer pathlib module. To iterate over files in a directory non-recursively:
possible blueprint:
Make
files
a Dictionary, create for each file a key with a list as the value and and the file's corresponding path to the list.Once the dict is complete, you can iterate over the dict looking for values with a length > 1.
To iterate over a directory, you may want to use the newer / nicer pathlib module. To iterate over files in a directory non-recursively:
>>> from pathlib import Path >>> p = Path('/path/to/dir') >>> for child in p.iterdir(): ... print(child)To iterate recursively:
>>> from pathlib import Path >>> p = Path('path/ot/dir') >>> for file in p.glob('*.*'): ... print(file)Regards, noisefloor