Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30532 > unrolled thread

Re: Compairing filenames in a list

Started byDave Angel <d@davea.name>
First post2012-09-29 21:41 -0400
Last post2012-09-29 21:41 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Compairing filenames in a list Dave Angel <d@davea.name> - 2012-09-29 21:41 -0400

#30532 — Re: Compairing filenames in a list

FromDave Angel <d@davea.name>
Date2012-09-29 21:41 -0400
SubjectRe: Compairing filenames in a list
Message-ID<mailman.1659.1348969290.27098.python-list@python.org>
On 09/29/2012 09:27 PM, Kevin Anthony wrote:
> I have a list of filenames, and i need to find files with the same
> name, different extensions, and split that into tuples.  does anyone have
> any suggestions on an easy way to do this that isn't O(n^2)?
>
>

Sure, collect them in a collections.defaultdict  Use basename for the
key, and a list of names as the data item.

if that's not good enough, show us your code, and why it doesn't work,
and tell us what version of Python you're using.

-- 

DaveA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web