reading a line in file
Brian.McCann at viziant.net
Mon Aug 20 21:54:07 CEST 2007
Shawn, Tim ,Jay
It looks like there are many ways this problem can be approached
either by using regex or a tokens
Tim I'm not familiar with your solution, but will learn about that method also
Jay, what do you mean by regex comes with a lot of overhead?
From: python-list-bounces+brian.mccann=viziant.net at python.org on behalf of Shawn Milochik
Sent: Mon 8/20/2007 3:07 PM
To: python-list at python.org
Subject: Re: reading a line in file
Hopefully this will help (using your input file)
buildinfo = "input.txt"
input = open(buildinfo, 'r')
regex = re.compile(r"^\s*build.number=(\d+)\s*$")
for line in input:
if re.search(regex, line):
buildNum = re.sub(r"^\s*build.number=(\d+)\s*$", "\\1", line)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list