Hi, I can read in the whole file build.number which has the following lines how do I just capture the value of build.number and assign it to a variable Thanks, Brian
contents of file build.number: #Build Number for ANT. Do not edit! #Mon Aug 20 04:04:51 EDT 2007 build.number=1 buildinfo.py ################################## #!/usr/bin/python import string import os import sys import time import errno import shutil buildinfo = "build.number" input = open(buildinfo, 'r') for line in input: print line ######################################### command line when script is run $ buildinfo.py #Build Number for ANT. Do not edit! #Mon Aug 20 04:04:51 EDT 2007 build.number=1 ________________________________ From: [EMAIL PROTECTED] on behalf of Shawn Milochik Sent: Mon 8/20/2007 1:29 PM To: python-list@python.org Subject: Re: reading a line in file Write some code, even if it doesn't quite work, and post it. We'll help you fix it. You can open a file with: input = open("file.txt", "r") You can read a line with: someText = input.readline() You can loop through an open file like this: for line in input: #do something with line That should get you started. -- http://mail.python.org/mailman/listinfo/python-list
-- http://mail.python.org/mailman/listinfo/python-list