On Aug 7, 1:35 am, Robert Dailey <[email protected]> wrote:
> I'm creating a python script that is going to try to search a text
> file for any text that matches my regular expression. The thing it is
> looking for is:
>
> FILEVERSION 1,45,10082,3
Would it be easier to do it without regex? The following is untested
but I would probably do it more like this:
TOKEN = 'FILEVERSION '
for line in file:
if line.startswith(TOKEN):
version = line[len(TOKEN):]
maj, min, rev, other = version.split(',')
break # if there's only one occurance, otherwise do stuff here
--
http://mail.python.org/mailman/listinfo/python-list