Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!news2.arglkargh.de!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'skip:[ 40': 0.07; 'filename': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:files': 0.09; 'subject:file': 0.13; 'received:173.11': 0.16; 'subset': 0.16; 'this?': 0.21; 'header:In-Reply-To:1': 0.22; 'picking': 0.23; 'worked': 0.23; 'code': 0.25; 'code.': 0.26; 'tried': 0.26; 'done.': 0.28; 'yield': 0.29; 'fix': 0.29; 'asking': 0.29; 'print': 0.29; 'list': 0.32; 'this.': 0.32; 'sort': 0.33; 'too': 0.33; 'to:addr:python-list': 0.33; 'named': 0.33; 'header:User-Agent:1': 0.34; 'but,': 0.34; 'header:X -Complaints-To:1': 0.35; 'thank': 0.35; 'subject:text': 0.35; 'file': 0.36; 'using': 0.37; 'received:org': 0.38; 'some': 0.38; 'should': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'data': 0.39; 'to:addr:python.org': 0.39; 'hope': 0.61; 'double': 0.61; 'imagine': 0.71; '100': 0.73; 'hand,': 0.76; 'username': 0.77; '25000': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: Arrange files according to a text file Date: Sat, 27 Aug 2011 18:10:07 -0700 References: <6j8i57t6cgqunn3c1ci4p7u9mnpnvsrl8s@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 173-11-108-137-sfba.hfc.comcastbusiness.net User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314493823 news.xs4all.nl 2430 [2001:888:2000:d::a6]:59739 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12324 On 8/27/2011 4:18 PM Ric@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