Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'sysadmin': 0.04; 'executing': 0.05; 'handler': 0.05; 'instance': 0.05; 'instance,': 0.05; 'onto': 0.05; 'parameter': 0.05; 'statistical': 0.05; ':-)': 0.06; '#if': 0.07; '-0700': 0.07; 'advance,': 0.07; 'bits': 0.07; 'function,': 0.07; 'https': 0.07; 'involves': 0.07; 'mess': 0.07; 'seemed': 0.07; 'tab': 0.07; 'terry': 0.07; 'threads,': 0.07; 'python': 0.08; '#print': 0.09; '(those': 0.09; 'argument,': 0.09; 'dict': 0.09; 'executed': 0.09; 'folks,': 0.09; 'follows.': 0.09; 'gmt': 0.09; 'hierarchical': 0.09; 'presume': 0.09; 'protocol.': 0.09; 'solution,': 0.09; 'splitting': 0.09; 'stolen': 0.09; 'tasks,': 0.09; 'text?': 0.09; 'thrown': 0.09; 'vote.': 0.09; 'pm,': 0.10; 'configure': 0.11; 'output': 0.11; '>>>': 0.12; 'def': 0.12; 'written': 0.14; 'am,': 0.14; 'debugging': 0.14; 'wrote:': 0.14; '"/"': 0.16; '"if"': 0.16; '#this': 0.16; '(chris': 0.16; '-tkc': 0.16; '1:13': 0.16; '2.6,': 0.16; 'algorithmic': 0.16; 'angelico': 0.16; 'another?': 0.16; 'answers.': 0.16; 'app.': 0.16; 'cable': 0.16; 'characters:': 0.16; 'computes': 0.16; 'copytree': 0.16; 'count)': 0.16; 'encountered.': 0.16; 'escapes': 0.16; 'filename,': 0.16; 'formatting.': 0.16; 'hierarchy': 0.16; 'instances.': 0.16; 'lengths': 0.16; 'logger.': 0.16; 'name),': 0.16; 'name):': 0.16; 'newborn': 0.16; 'out)': 0.16; 'placeholder': 0.16; 'printing.': 0.16; 'rebert': 0.16; 'reedy': 0.16; 'regexp': 0.16; 'roy': 0.16; 'set:': 0.16; 'shouting': 0.16; 'stuff)': 0.16; 'subject:print': 0.16; 'suffers': 0.16; 'thread.': 0.16; 'uploading': 0.16; 'using,': 0.16; 'verifying': 0.16; 'wind': 0.16; '\xa0>>>': 0.16; '\xa0as': 0.16; '\xa0def': 0.16; '\xa0for': 0.16; '\xa0print': 0.16; 'argument': 0.16; '----------': 0.16; '(i.e.': 0.17; 'candidate': 0.17; 'meant': 0.18; '-0500': 0.19; 'comment:': 0.19; 'cheers,': 0.19; 'issue.': 0.19; 'writes:': 0.19; 'jan': 0.20; '(which': 0.20; 'posting': 0.21; 'appears': 0.21; 'figure': 0.21; "aren't": 0.22; 'connections': 0.22; 'loop': 0.22; 'code.': 0.22; 'memory': 0.22; 'unsubscribe': 0.78; 'strategies': 0.78; '(tim': 0.84; '801': 0.84; 'abuse.': 0.84; 'anywhere.': 0.84; 'complex,': 0.84; 'convey': 0.84; 'destination,': 0.84; 'dict,': 0.84; 'drm': 0.84; 'evolved': 0.84; 'filename:': 0.84; 'leak': 0.84; 'namely': 0.84; 'node': 0.84; 'prohibit': 0.84; 'ridiculously': 0.84; "\xa0i'm": 0.84; '\xa0of': 0.84; '169': 0.91; 'amongst': 0.91; 'checks.': 0.91; 'existed': 0.91; 'good,': 0.91; 'similar.': 0.91; 'tracks': 0.91; 'river': 0.93; 'certificates': 0.95; 'safer': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=6pjB0N9Xxp/BfWW3DAVS/PZkdYilSqqmbr7hPsdD7kI=; b=cF8XRbcgfLOm0zN9CzsQB3sxJai/+J98XravVZRVlf55lrp0YvqM1SzjuDDvipA104 ALZMuH5b9KfudXHGHXDYmMCQpDKxEiHn1ojfAgjD0aYTBVMZY5YpKU4AKjrrzyaeEoDe 57AfsX0Qkf4L2jt144WlcxCmIMBEaQEE3ozSk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=kZiQ6Oj/moFB/f+MIhrfDnI2CMhqzdhNrqQ1j9G8a2ypa+WeM5DmlZSjui6osF3KhX 7hPz2pUjrBHlxEScvb6lb8WxXbO2e6IY6ti/1gjGNrHHbOjTn+qWlO1cdykO5Q+0/1wZ lC0m3fRFYGcPkZLSjc3Jzp9hXtr4GpYFIpUn4= MIME-Version: 1.0 Date: Sat, 18 Jun 2011 23:57:03 -0500 Subject: print header for output From: Cathy James To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 529 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308459425 news.xs4all.nl 49046 [::ffff:82.94.164.166]:34646 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7942 I managed to get output for my function, thanks much for your direction. I really appreciate the hints. Now I have tried to place the statement "print ("Length \t" + "Count\n")" in different places in my code so that the function can print the headers only one time in this manner: Count Length 4 7 8 1 12 2 Code so far: def fileProcess(filename =3D open('declaration.txt', 'r')): """Call the program with an argument, it should treat the argument as a filename, splitting it up into words, and computes the length of each word. print a table showing the word count for each of the word lengths that has been encountered.""" freq =3D {} #empty dict to accumulate word count and word length print ("Length \t" + "Count\n") for line in filename: punc =3D string.punctuation + string.whitespace#use Python's built-in punctuation and whiitespace for word in (line.replace (punc, "").lower().split()): if word in freq: freq[word] +=3D1 #increment current count if word already i= n dict else: freq[word] =3D 1 #if punctuation encountered, frequency=3D0 word length =3D 0 #print ("Length \t" + "Count\n")#print header for all numbers. for word, count in freq.items(): print(len(word), count) fileProcess() On Sat, Jun 18, 2011 at 7:09 PM, wrote: > Send Python-list mailing list submissions to > =A0 =A0 =A0 =A0python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > =A0 =A0 =A0 =A0http://mail.python.org/mailman/listinfo/python-list > or, via email, send a message with subject or body 'help' to > =A0 =A0 =A0 =A0python-list-request@python.org > > You can reach the person managing the list at > =A0 =A0 =A0 =A0python-list-owner@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Python-list digest..." > > Today's Topics: > > =A0 1. Re: How do you copy files from one location to another? > =A0 =A0 =A0(Terry Reedy) > =A0 2. Re: Strategy to Verify Python Program is POST'ing to a web > =A0 =A0 =A0server. (Paul Rubin) > =A0 3. Re: Strategy to Verify Python Program is POST'ing to a web > =A0 =A0 =A0server. (Terry Reedy) > =A0 4. Re: debugging https connections with urllib2? (Roy Smith) > =A0 5. Re: Improper creating of logger instances or a Memory Leak? > =A0 =A0 =A0(Chris Torek) > =A0 6. Re: Strategy to Verify Python Program is POST'ing to a web > =A0 =A0 =A0server. (Chris Angelico) > =A0 7. NEED HELP-process words in a text file (Cathy James) > =A0 8. Re: NEED HELP-process words in a text file (Chris Rebert) > =A0 9. Re: NEED HELP-process words in a text file (Tim Chase) > > > ---------- Forwarded message ---------- > From:=A0Terry Reedy > To:=A0python-list@python.org > Date:=A0Sat, 18 Jun 2011 16:52:26 -0400 > Subject:=A0Re: How do you copy files from one location to another? > On 6/18/2011 1:13 PM, Michael Hrivnak wrote: >> >> Python is great for automating sysadmin tasks, but perhaps you should >> just use rsync for this. =A0It comes with the benefit of only copying >> the changes instead of every file every time. >> >> "rsync -a C:\source E:\destination" and you're done. > > Perhaps 'synctree' would be a candidate for addition to shutil. > > If copytree did not prohibit an existing directory as destination, it cou= ld be used for synching with an 'ignore' function. > > -- > Terry Jan Reedy > > > > > ---------- Forwarded message ---------- > From:=A0Paul Rubin > To:=A0python-list@python.org > Date:=A0Sat, 18 Jun 2011 14:03:19 -0700 > Subject:=A0Re: Strategy to Verify Python Program is POST'ing to a web ser= ver. > "mzagursk@gmail.com" writes: >> For example, if I create a website that tracks some sort of >> statistical information and don't ensure that my program is the one >> that is uploading it, the statistics can be thrown off by people >> entering false POST data onto the data upload page. =A0Any remedy? > > If you're concerned about unauthorized users posting random crap, the > obvious solution is configure your web server to put password protection > on the page. > > If you're saying AUTHORIZED users (those allowed to use the program to > post stuff) aren't trusted to not bypass the program, you've basically > got a DRM problem, especially if you think the users might > reverse-engineer the program to figure out the protocol. =A0The most > effective approaches generally involve delivering the program in the > form of a hardware product that's difficult to tamper with. =A0That's wha= t > cable TV boxes amount to, for example. > > What is the application, if you can say? =A0That might help get better > answers. > > > > ---------- Forwarded message ---------- > From:=A0Terry Reedy > To:=A0python-list@python.org > Date:=A0Sat, 18 Jun 2011 17:17:09 -0400 > Subject:=A0Re: Strategy to Verify Python Program is POST'ing to a web ser= ver. > On 6/18/2011 7:34 AM, mzagursk@gmail.com wrote: >> >> Hello Folks, >> >> I am wondering what your strategies are for ensuring that data >> transmitted to a website via a python program is indeed from that >> program, and not from someone submitting POST data using some other >> means. =A0I find it likely that there is no solution, in which case what >> is the best solution for sending data to a remote server from a python >> program and ensuring that it is from that program? >> >> For example, if I create a website that tracks some sort of >> statistical information and don't ensure that my program is the one >> that is uploading it, the statistics can be thrown off by people >> entering false POST data onto the data upload page. =A0Any remedy? > > You have not specified all the parameters of the problem. Are there a lim= ited number of copies of your program or are they distrubuted freely? What = about multiple votes from one program? > > Corporate proxy votes (which are a legally important type of statistical = information) work as follows. Each shareholder is mailed or emailed a 'cont= rol number'. Attend stockholder meeting in person, mail proxy vote, or logi= n with any browser with control number. Repeat votes by the same control id= supercede previous vote. There should be a 'thank you for voting' response= for each vote. I suspect IP addr. is recorded with vote too. I have not he= ard of specific problems with electronic proxy voting. > > -- > Terry Jan Reedy > > > > > ---------- Forwarded message ---------- > From:=A0Roy Smith > To:=A0python-list@python.org > Date:=A0Sat, 18 Jun 2011 17:45:42 -0400 > Subject:=A0Re: debugging https connections with urllib2? > In article <4dfcff48$0$49184$e4fe514c@news.xs4all.nl>, > =A0Irmen de Jong wrote: > >> On 18-6-2011 20:57, Roy Smith wrote: >> > We've got a REST call that we're making to a service provider over htt= ps >> > using urllib2.urlopen(). =A0Is there any way to see exactly what's get= ting >> > sent and received over the network (i.e. all the HTTP headers) in plai= n >> > text? >> >> Put a proxy between the https-service endpoint and your client app. >> Let the proxy talk https and let your client talk http to the proxy. > > Clever. =A0I like. =A0Thanks. > > > > ---------- Forwarded message ---------- > From:=A0Chris Torek > To:=A0python-list@python.org > Date:=A018 Jun 2011 22:28:39 GMT > Subject:=A0Re: Improper creating of logger instances or a Memory Leak? > In article > foobar =A0 wrote: >>I've run across a memory leak in a long running process which I can't >>determine if its my issue or if its the logger. > > You do not say what version of python you are using, but on the > other hand I do not know how much the logger code has evolved > over time anyway. :-) > >> Each application thread gets a logger instance in it's init() method >>via: >> >> =A0 =A0 =A0 =A0self.logger =3D logging.getLogger('ivr-'+str(self.rand)) >> >>where self.rand is a suitably large random number to avoid collisions >>of the log file's name. > > This instance will "live forever" (since the thread shares the > main logging manager with all other threads). > --------- > class Manager: > =A0 =A0""" > =A0 =A0There is [under normal circumstances] just one Manager instance, w= hich > =A0 =A0holds the hierarchy of loggers. > =A0 =A0""" > =A0 =A0def __init__(self, rootnode): > =A0 =A0 =A0 =A0""" > =A0 =A0 =A0 =A0Initialize the manager with the root node of the logger hi= erarchy. > =A0 =A0 =A0 =A0""" > =A0 =A0 =A0 =A0[snip] > =A0 =A0 =A0 =A0self.loggerDict =3D {} > > =A0 =A0def getLogger(self, name): > =A0 =A0 =A0 =A0""" > =A0 =A0 =A0 =A0Get a logger with the specified name (channel name), creat= ing it > =A0 =A0 =A0 =A0if it doesn't yet exist. This name is a dot-separated hier= archical > =A0 =A0 =A0 =A0name, such as "a", "a.b", "a.b.c" or similar. > > =A0 =A0 =A0 =A0If a PlaceHolder existed for the specified name [i.e. the = logger > =A0 =A0 =A0 =A0didn't exist but a child of it did], replace it with the c= reated > =A0 =A0 =A0 =A0logger and fix up the parent/child references which pointe= d to the > =A0 =A0 =A0 =A0placeholder to now point to the logger. > =A0 =A0 =A0 =A0""" > =A0 =A0 =A0 =A0[snip] > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self.loggerDict[name] =3D rv > =A0 =A0 =A0 =A0[snip] > [snip] > Logger.manager =3D Manager(Logger.root) > --------- > > So you will find all the various ivr-* loggers in > logging.Logger.manager.loggerDict[]. > >>finally the last statements in the run() method are: >> >> =A0 =A0 =A0 =A0filehandler.close() >> =A0 =A0 =A0 =A0self.logger.removeHandler(filehandler) >> =A0 =A0 =A0 =A0del self.logger #this was added to try and force a clean = up of >>the logger instances. > > There appears to be no __del__ handler and nothing that allows > removing a logger instance from the manager's loggerDict. =A0Of > course you could do this "manually", e.g.: > > =A0 =A0 =A0 =A0... > =A0 =A0 =A0 =A0self.logger.removeHandler(filehandler) > =A0 =A0 =A0 =A0del logging.Logger.manager.loggerDict[self.logger.name] > =A0 =A0 =A0 =A0del self.logger # optional > > I am curious as to why you create a new logger for each thread. > The logging module has thread synchronization in it, so that you > can share one log (or several logs) amongst all threads, which is > more typically what one wants. > -- > In-Real-Life: Chris Torek, Wind River Systems > Salt Lake City, UT, USA (40=B039.22'N, 111=B050.29'W) =A0+1 801 277 2603 > email: gmail (figure it out) =A0 =A0 =A0http://web.torek.net/torek/index.= html > > > > ---------- Forwarded message ---------- > From:=A0Chris Angelico > To:=A0python-list@python.org > Date:=A0Sun, 19 Jun 2011 09:12:13 +1000 > Subject:=A0Re: Strategy to Verify Python Program is POST'ing to a web ser= ver. > On Sun, Jun 19, 2011 at 6:40 AM, Michael Hrivnak w= rote: >> On Sat, Jun 18, 2011 at 1:26 PM, Chris Angelico wrote= : >>> SSL certificates are good, but they can be stolen (very easily if the >>> client is open source). Anything algorithmic suffers from the same >>> issue. >> >> This is only true if you distribute your app with one built-in >> certificate, which does indeed seem like a bad idea. =A0When you know >> your user base though, especially if this is a situation with a small >> number of deployments, than you can distribute a unique certificate to >> each client, signed by your CA. > > That changes it from verifying the program to verifying the user. It's > a somewhat different beast, but it still leaves the possibility of > snagging the cert and using it in another program. Same with IP > address checks. You can't prove that the other end is a particular > program. > >>> You could go a long way toward it, though, by >>> using something ridiculously complex, such as: >>> ... >> >> An authentication process that involves the client executing code >> supplied by the server opens up one single point of failure (server is >> compromised or man-in-the-middle attack is happening) by which >> arbitrary code could get executed on the client. =A0Yikes! > > Yeah, hence the part of verifying the server's cert too. That one is a > bit safer though; nobody but you will have that certificate, so it's > not as easy to take and put into another program. But this whole > scheme was meant from the start to be ridiculous. > >> If ... >> then you'll have to accept that you cannot trust the submitted data >> 100%, and just take measures to mitigate abuse. > > I still stand by my original point, namely that the "if" on here is > superfluous, and the "then" is unconditional. But the measures you > describe _do_ reduce the likelihood significantly. > > ChrisA > > > > ---------- Forwarded message ---------- > From:=A0Cathy James > To:=A0python-list@python.org > Date:=A0Sat, 18 Jun 2011 18:21:55 -0500 > Subject:=A0NEED HELP-process words in a text file > Dear Python Experts, > > First, I'd like to convey my appreciation to you all for your support > and contributions. =A0I am a Python newborn and need help with my > function. I commented on my program as to what it should do, but > nothing is printing. I know I am off, but not sure where. Please > help:( > > import string > def fileProcess(filename): > =A0 =A0"""Call the program with an argument, > =A0 =A0it should treat the argument as a filename, > =A0 =A0splitting it up into words, and computes the length of each word. > =A0 =A0print a table showing the word count for each of the word lengths > that has been encountered. > =A0 =A0Example: > =A0 =A0Length Count > =A0 =A01 16 > =A0 =A02 267 > =A0 =A03 267 > =A0 =A04 169 > =A0 =A0>>>"&" > =A0 =A0Length =A0 =A0Count > =A0 =A00 =A0 =A00 > =A0 =A0>>> > =A0 =A0>>>"right." > =A0 =A0Length =A0 =A0Count > =A0 =A05 =A0 =A010 > =A0 =A0""" > =A0 =A0freq =3D [] #empty dict to accumulate words and word length > =A0 =A0filename=3Dopen('declaration.txt, r') > =A0 =A0for line in filename: > =A0 =A0 =A0 =A0punc =3D string.punctuation + string.whitespace#use Python= 's > built-in punctuation and whiitespace > =A0 =A0 =A0 =A0for i, word in enumerate (line.replace (punc, "").lower().= split()): > =A0 =A0 =A0 =A0 =A0 =A0if word in freq: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0freq[word] +=3D1 #increment current count = if word already in dict > > =A0 =A0 =A0 =A0 =A0 =A0else: > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0freq[word] =3D 0 #if punctuation encounter= ed, > frequency=3D0 word length =3D 0 > =A0 =A0 =A0 =A0for word in freq.items(): > =A0 =A0 =A0 =A0 =A0 =A0print("Length /t"+"Count/n"+ freq[word],+'/t' + > len(word))#print word count and length of word separated by a tab > > > > > =A0 =A0#Thanks in advance, > CJ. > > > > ---------- Forwarded message ---------- > From:=A0Chris Rebert > To:=A0Cathy James > Date:=A0Sat, 18 Jun 2011 16:30:00 -0700 > Subject:=A0Re: NEED HELP-process words in a text file > On Sat, Jun 18, 2011 at 4:21 PM, Cathy James wrote: >> Subject: NEED HELP-process words in a text file >> >> Dear Python Experts, >> >> First, I'd like to convey my appreciation to you all for your support >> and contributions. =A0I am a Python newborn and need help with my >> function. I commented on my program as to what it should do, but >> nothing is printing. I know I am off, but not sure where. Please >> help:( > > Netiquette comment: Please avoid SHOUTING and including unnecessary > entreaties in your subject lines in the future. > > Cheers, > Chris > > > > ---------- Forwarded message ---------- > From:=A0Tim Chase > To:=A0Cathy James > Date:=A0Sat, 18 Jun 2011 19:09:18 -0500 > Subject:=A0Re: NEED HELP-process words in a text file > On 06/18/2011 06:21 PM, Cathy James wrote: > >> =A0 =A0 freq =3D [] #empty dict to accumulate words and word length > > While you say you create an empty dict, using "[]" creates an empty *list= *, not a dict. =A0Either your comment is wrong or your code is wrong. :) = =A0Given your usage, I presume you want a dict, not a list. > >> =A0 =A0 for line in filename: >> =A0 =A0 =A0 =A0 punc =3D string.punctuation + string.whitespace#use Pyth= on's >> built-in punctuation and whiitespace > > Since you don't change "punc" in your loop, you'd get better performance = by hoisting this outside of the loop so it's only evaluated once. =A0Not th= at it should matter *that* greatly, but it's just a bad-code-smell. > >> =A0 =A0 =A0 =A0 for i, word in enumerate (line.replace (punc, "").lower(= ).split()): > > .replace() doesn't operate on sets of characters, but rather strings. =A0= So unless your line contains the exact text in "punc" (unlikely), that repl= acement is a NOP. =A0There are a couple ways to go about removing unwanted = characters: > > - make a set of those characters and produce a resulting string from thin= gs not in that set: > > =A0punc_set =3D set(punc) > =A0line =3D ''.join(c for c in line if c not in punc_set) > > - use a regexp to strip them out...something like > > =A0punc_re =3D re.compile("[" + re.escape(punc) + "]") > =A0... > =A0line =3D punc_re.sub('', line) > > - use string translations. =A0I'm not as familiar with these, but the fol= lowing seemed to work for me, abusing the 2nd "deletechars" parameter for y= our particular use-case: > > =A0line =3D line.translate(None, punc) > > I don't see .translate(None) documented anywhere. =A0My random effort see= med to work in 2.6, but fails in 2.5 and prior. =A0YMMV. > >> =A0 =A0 =A0 =A0 =A0 =A0 if word in freq: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 freq[word] +=3D1 #increment current coun= t if word already in dict >> >> =A0 =A0 =A0 =A0 =A0 =A0 else: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 freq[word] =3D 0 #if punctuation encount= ered, >> frequency=3D0 word length =3D 0 > > Again, your 2nd comment disagrees with your code. =A0As an aside, if you'= re using 2.5 or greater, I'd use collections.defaultdict(int) as the accumu= lator: > > =A0freq =3D collections.defaultdict(int) > =A0... > =A0freq[word] +=3D 1 > =A0# no need to check presence > >> =A0 =A0 =A0 =A0 for word in freq.items(): >> =A0 =A0 =A0 =A0 =A0 =A0 print("Length /t"+"Count/n"+ freq[word],+'/t' + >> len(word))#print word count and length of word separated by a tab > > Where to begin: > > - Your escapes are using "/" instead of "\" for and which= I expect will mess up the formatting. > > - You're also labeling them "Length/Count" but printing "count/length". > > - you're iterating over freq.items() but that should be written as > > =A0for word, count in freq.items(): > > or > > =A0for word in freq: > > - =A0Additionally, adding the bits together makes it somewhat hard to und= erstand. > > I'd use something like > > =A0for word, count in freq.items(): > =A0 =A0print("Word \tLength \tCount\n%s \t%i \t%i" % ( > =A0 =A0 =A0word, len(word), count)) > > -tkc > > > > > -- > http://mail.python.org/mailman/listinfo/python-list >