Re: [Tutor] Algorithm

2009-08-24 Thread kreglet
Alan, Thanks for the reply. This is not homework, it is a hobby. I am 44 years old. I was using Visual Basic, but recently decided to switch to Linux and have no intentions of going back to windows. Python seems like a good computer language. I read somewhere the the best way to learn it was to

Re: [Tutor] Algorithm

2009-08-24 Thread Wayne
On Sun, Aug 23, 2009 at 10:01 PM, kreglet wrote: > > Alan, > > Thanks for the reply. This is not homework, it is a hobby. I am 44 years > old. I was using Visual Basic, but recently decided to switch to Linux and > have no intentions of going back to windows. Python seems like a good > computer

Re: [Tutor] Algorithm

2009-08-24 Thread Mac Ryan
On Sun, 2009-08-23 at 15:06 -0700, kreglet wrote: > Hello, > > The problem that I am having is writing an algorithm for finding all the > possible words from a given word. For example: python > > from "python" you can make the words pot, top, hop, not etc. There are few > examples for making an

[Tutor] Ptyhon GUI doubt

2009-08-24 Thread Reddy Etikela, Rajasekhar
Hi, I am new to the Python. I have installed Python 2.6.2 version in windows XP. When I try to open the IDLE(Python GUI), getting the below message. Any configuration settings required for this? [cid:675172311@24082009-0830] Please let me know the details. Thanks, Raj <>__

Re: [Tutor] Algorithm

2009-08-24 Thread kreglet
Wayne, The reason I used print sorted is that using just print throws a syntax error: print (lettercount.iteritems(), key=itemgetter(1)) ---> error print lettercount.iteritems(), key=itemgetter(1) ---> error print sorted(lettercount.iteritems(), key=itemgetter(1)) ---> works I don't know why

Re: [Tutor] Algorithm

2009-08-24 Thread kreglet
Hello Mac, Thanks for the tip. I was aware of an and considered using it. I decided not to use it unless I have no other choice. Although it does exactly what I am after: a) I don't want to use any dependencies other than Python's built in modules b) You hit it right in the nose when you

Re: [Tutor] Algorithm

2009-08-24 Thread Wayne
On Mon, Aug 24, 2009 at 10:48 AM, kreglet wrote: > > Wayne, > > The reason I used print sorted is that using just print throws a syntax > error: > > print (lettercount.iteritems(), key=itemgetter(1)) ---> error > print lettercount.iteritems(), key=itemgetter(1) ---> error > print sorted(lettercou

Re: [Tutor] Algorithm

2009-08-24 Thread Alan Gauld
"kreglet" wrote The reason I used print sorted is that using just print throws a syntax error: print (lettercount.iteritems(), key=itemgetter(1)) ---> error print lettercount.iteritems(), key=itemgetter(1) ---> error print sorted(lettercount.iteritems(), key=itemgetter(1)) ---> works I don't

[Tutor] Template long text substitution

2009-08-24 Thread Stefan Lesicnik
Hi Guys, I am trying to do the following, and im not sure how to deal with a blob of text. I have the following file i am using as a template %%NAME%% %%NUMBER%% %%REPORT%% and i have a corresponding file with values name="bob" number="123" report="report is long and spans multiple lines. It a

Re: [Tutor] Template long text substitution

2009-08-24 Thread Serdar Tumgoren
Stefan, Have you considered a templating engine such as Jinja or Cheetah? http://jinja.pocoo.org/2/ www.cheetahtemplate.org/ They should be able to handle a lot of the parsing and pairing of variables in a template that you're attempting. Basically, you use template syntax (as you seem to have c

[Tutor] Pexpect latest version.

2009-08-24 Thread Mac Ryan
Hello everybody, this is more a request of info than of help. I want to play around with pexpect a bit, but I am confused on what is the latest stable version. On SF (linked from the site of the pexpect developer) http://pexpect.sourceforge.net/pexpect.html it seems the latest version (

Re: [Tutor] Template long text substitution

2009-08-24 Thread Dave Angel
Stefan Lesicnik wrote: Hi Guys, I am trying to do the following, and im not sure how to deal with a blob of text. I have the following file i am using as a template %%NAME%% %%NUMBER%% %%REPORT%% and i have a corresponding file with values name="bob" number="123" report="report is long and s

Re: [Tutor] Ptyhon GUI doubt

2009-08-24 Thread Mal Wanstall
Hi Raj, I used to get this error sometimes when I was using Windows. Killing the Python process via Task Manager and restarting IDLE was enough to get me going but if it still remains an issue, you can run Python in single process mode, the following is snipped from IDLE help: "Running without a

Re: [Tutor] Algorithm

2009-08-24 Thread kreglet
Wayne, > def myfunc(cmpword, mainword): > for letter in cmpword: > if mainword.gets(letter): > if cmpword[letter] >mainword[letter]: > return False > else: > return False I tried your function and couldn't get it to work. It threw an error in the line "if