On 20/08/07, Brian McCann <[EMAIL PROTECTED]> wrote: > > Shawn, Tim ,Jay > > many thanks, > > 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
Hi Brian, > buildNum = open('input.txt').read().split('build.number=')[1].split()[0] Try this on its own: print open('input.txt').read().split('build.number=') See what is at the very beginning of the 2nd list item :) My example just splits the whole file at "build.number=", so you know the data you require is at the beginning of the 2nd list item returned from the slice [ie: a_list[1]. You also know that data is followed by a newline, so it will be the first item in the returned list [ie: b_list[0] when you split a_list[1]. No need to iterate each line individually looking for a match and then process the matching line to get at the data. You can just go straight to the data you require. If your requirement is for multiple items from a single file then another method would be required. :) -- http://mail.python.org/mailman/listinfo/python-list