Arrange files according to a text file
Emile van Sebille
emile at fenx.com
Sat Aug 27 21:10:07 EDT 2011
On 8/27/2011 4:18 PM Ric at rdo.python.org said...
> Thank you so much. The code worked perfectly.
>
> This is what I tried using Emile code. The only time when it picked
> wrong name from the list was when the file was named like this.
>
> Data Mark Stone.doc
>
> How can I fix this? Hope I am not asking too much?
What name did it pick? I imagine if you're picking a name from a list
of 25000 names that some subset of combinations may yield like ratios.
But, if you double up on the file name side you may get closer:
for filename in filenames:
ratios = [SM(ignore,filename+filename,username).ratio() for
username in usernames]
best = max(ratios)
owner = usernames[ratios.index(best)]
print filename,":",owner
... on the other hand, if you've only got a 100 files to sort out, you
should already be done.
:)
Emile
More information about the Python-list
mailing list