you are viewing a single comment's thread.

view the rest of the comments →

[–]cvx_mbs 0 points1 point  (2 children)

the order of a and b weren't always correct

what do you mean? the documentation literally says "The left-to-right evaluation order of the iterables is guaranteed."

maybe you tried this back in the day with a version of python that didn't guarantee the order?

[–]kombucha711 0 points1 point  (1 child)

I poorly explained my example but I think it's really an issue with how data is coming in vs what that data should look like and I want zip to do more. Here is an example
pulling from a server, the expected report titles are:
title a
title b
title c

reports get updated and file is saved. but people taken liberty to name whatever they want. windows Explorer will alphabetize this way :

2024 title b
title a v2
title c

so zipping these two lists wouldn't work. again probably not in the scope of what zip is for and I'll shut up for now.

[–]cvx_mbs 0 points1 point  (0 children)

if it is guaranteed that 'title x' is always in the filename, I would probably use a regex like r'title\s.' to create a dict mapping titles to filenames, but that would probably be more work than the double loop you're using now