Arrange files according to a text file
me+list/python at ixokai.io
Sun Aug 28 01:31:15 CEST 2011
On 8/27/11 11:06 AM, Emile van Sebille wrote:
> from difflib import SequenceMatcher as SM
> def ignore(x):
> return x in ' ,.'
> for filename in filenames:
> ratios = [SM(ignore,filename,username).ratio() for username in
> best = max(ratios)
> owner = usernames[ratios.index(best)]
> print filename,":",owner
It amazes me that I can still find a surprising new tool in the stdlib
after all these years.
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog: http://meh.ixokai.io/
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 487 bytes
Desc: OpenPGP digital signature
More information about the Python-list