Re: [Tutor] Still having trouble with my game of life algorithm

2007-05-25 Thread Jerry Hill
On 5/25/07, Matt Smith <[EMAIL PROTECTED]> wrote: > def update_matrix(matrix): > matrix_updated = matrix That line assigns the name matrix_updated to the same list-of-lists as matrix. Since lists are mutable objects, changing matrix_updated is also changing matrix. What you need is to bind m

Re: [Tutor] Still having trouble with my game of life algorithm

2007-05-25 Thread Alan Gauld
"Matt Smith" <[EMAIL PROTECTED]> wrote in > re-written the function that applies the rules but it still doesn't > return the expected result. Care to tell us what you think it's doing wrong? Some sample data maybe? A casual glance at the code looks OK, but I haven't studied all the boundary

Re: [Tutor] Still having trouble with my game of life algorithm

2007-05-25 Thread Ken Oliver
-Original Message- >From: Matt Smith <[EMAIL PROTECTED]> >Sent: May 25, 2007 4:31 PM >To: Python Tutor >Subject: [Tutor] Still having trouble with my game of life algorithm > >Hi, > >First of all, thanks to everyone who helped with my last post >(http://mail.python.org/pipermail/tutor/20

[Tutor] Still having trouble with my game of life algorithm

2007-05-25 Thread Matt Smith
Hi, First of all, thanks to everyone who helped with my last post (http://mail.python.org/pipermail/tutor/2007-May/054360.html). I have re-written the function that applies the rules but it still doesn't return the expected result. I have been through it and corrected a couple of bugs bet as far a

Re: [Tutor] Hands-On Python

2007-05-25 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote > Does anyone know how to get this added to this page? > http://wiki.python.org/moin/BeginnersGuide/NonProgrammers > An email to Fred Drake I think. Alan G ___ Tutor maillist - Tutor@python.org http://mail

[Tutor] I'm clearly not getting an important pygtk concept

2007-05-25 Thread John
I created the following script to test my understanding of creating simple pygtk GUIs. #!/usr/bin/python2.5 import gtk, urllib def pinger_shotgun(): """This function stores an object that pings Peter's writerscafe.org pages.""" open_page = urllib.urlopen(web) def plink(widget, web): pr

[Tutor] creating a buffer object from a file ?

2007-05-25 Thread Iyer
I think this got lost among the threads: thanks, alan for your helpful response. in reality what is a buffer object used for ? reading a file itself creates a string as in itself, file_handle = file ("path_to_file") file_data = file_handle.read() # file_data is a string, so why is a buffer

Re: [Tutor] Replacing characters

2007-05-25 Thread Kent Johnson
Per Jr. Greisen wrote: > Hi, > > I am replacing 4 characters with a number and I would like to make the > whitespace dynamic so > for fx. 1 it uses 3 whitespace and for 10 two and for 100 one etc. I am > using the replace() method. I'm not too sure what you want to do but probably str.rjust() o

Re: [Tutor] html links

2007-05-25 Thread Thorsten Kampe
* max . (Mon, 14 May 2007 20:27:15 -0600) > does anyone know of a tutorial for finding links in a web site with python. import formatter, \ htmllib, \ urllib url = 'http://python.org' htmlp = htmllib.HTMLParser(formatter.NullFormatter()) htmlp.feed(urllib.urlopen(url).read()) htm

[Tutor] Replacing characters

2007-05-25 Thread Per Jr. Greisen
Hi, I am replacing 4 characters with a number and I would like to make the whitespace dynamic so for fx. 1 it uses 3 whitespace and for 10 two and for 100 one etc. I am using the replace() method. Any help or advice appreciated Thanks in advance ___ T

[Tutor] Hands-On Python

2007-05-25 Thread Kent Johnson
Here is a tutorial I wasn't aware of. It includes videos for some sections and claims that exercises will be coming soon: http://www.cs.luc.edu/~anh/python/hands-on/handsonHtml/handson.html Does anyone know how to get this added to this page? http://wiki.python.org/moin/BeginnersGuide/NonProgramm

Re: [Tutor] please help formating

2007-05-25 Thread Kent Johnson
Just for fun, here is a parser written with pyparsing. It treats newlines as whitespace so it will work with the split data you posted. http://pyparsing.wikispaces.com/ data = '''(39577484, 39577692) [['NM_003750']] (107906, 108011) [['NM_002443']] (113426, 113750) [['NM_138634', 'NM_002443']] (1

Re: [Tutor] please help formating

2007-05-25 Thread Kent Johnson
kumar s wrote: > hi group, > > i have a data obtained from other student(over 100K) > lines that looks like this: > (39577484, 39577692) [['NM_003750']] > (107906, 108011) [['NM_002443']] > (113426, 113750) [['NM_138634', 'NM_002443']] > (106886, 106991) [['NM_138634', 'NM_002443']] > (100708, 100

Re: [Tutor] dealing with nested list values in a dictionary

2007-05-25 Thread Kent Johnson
kumar s wrote: > Dear group, > > unfortunately my previous post got tagged as > 'homework' mail and got no responses. > > In short, I have a dictionary structure as depicted > below. > > I want to go over every key and print the key,value > pairs in a more sensible way. > > I have written a