Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12318
| Date | 2011-08-27 16:31 -0700 |
|---|---|
| From | Stephen Hansen <me+list/python@ixokai.io> |
| Subject | Re: Arrange files according to a text file |
| References | <6j8i57t6cgqunn3c1ci4p7u9mnpnvsrl8s@4ax.com> <j3bbmv$luo$1@dough.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.493.1314487883.27778.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
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 > usernames] > 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. Neat. /pinboards -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Arrange files according to a text file Ric@rdo - 2011-08-27 13:03 -0400
Re: Arrange files according to a text file MRAB <python@mrabarnett.plus.com> - 2011-08-27 18:22 +0100
Re: Arrange files according to a text file Emile van Sebille <emile@fenx.com> - 2011-08-27 11:06 -0700
Re: Arrange files according to a text file Ric@rdo - 2011-08-27 16:15 -0400
Re: Arrange files according to a text file Emile van Sebille <emile@fenx.com> - 2011-08-27 14:08 -0700
Re: Arrange files according to a text file Ric@rdo - 2011-08-27 19:18 -0400
Re: Arrange files according to a text file MRAB <python@mrabarnett.plus.com> - 2011-08-28 00:48 +0100
Re: Arrange files according to a text file Ric@rdo - 2011-08-27 20:21 -0400
Re: Arrange files according to a text file Emile van Sebille <emile@fenx.com> - 2011-08-27 18:10 -0700
Re: Arrange files according to a text file Ric@rdo - 2011-08-28 01:24 -0400
Re: Arrange files according to a text file Stephen Hansen <me+list/python@ixokai.io> - 2011-08-27 16:31 -0700
csiph-web