Re: [Tutor] Learning Python from books

2008-06-19 Thread Jason Conner
I use the same books - Learning Python and Core Python Programming, 2nd ed. I found I got about halfway through Learning Python before I switched to CPP and had no problems. I also use "Python Phrasebook" (Brad Dayley, 2007) as a handy reference guide to some common problems as well. Core Python P

Re: [Tutor] Reading only a few specific lines of a file

2008-05-24 Thread Jason Conner
Hey guys, I went with a combination of the above, though I tried several different solutions. Here's what I ended up with: def loadItem(self, objectToLoad): wordList = [] fobj = open('/home/jason.conner/Documents/Python/objectconfig.txt', 'r') for line in fobj: if line == obj

[Tutor] Reading only a few specific lines of a file

2008-05-22 Thread Jason Conner
Hey guys, Very new to programming Python, and I'm running up against a problem. I am building a program that will take a text file, search for a string in that text file. Once it finds the string its looking for, I want to put the next five lines of text into a variable. Here's what I have so far: