castironpi wrote:
...


I don't think that's guaranteed by anything.  I realized that
'dat.sort()' and 'txt.sort()' weren't necessary, since their contents
are moved to a dictionary, which isn't sorted.
Actually, I'm getting the file names from listdir, and they appear to be sorted low to high. I tried it on a folder with lots of dissimilar files.

both= set( datD.keys() )& set( txtD.keys() )

This will get you the keys (prefixes) that are in both.  Then for
every prefix if it's not in 'both', you can report it.

Lastly, since you suggest you're guaranteed that 'txt' will all share
the same extension, you can do away with the dictionary and use sets
entirely.  Only if you can depend on that assumption.
Each dat file contains an image, and its description and related parameters are in the corresponding txt file.

I took a look at this.  It's probably more what you had in mind, and
the dictionaries are overkill.
...
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to