I am new to Python and am looking for something in Python that is equivalent to parsing files in Perl. I have a text file as follows.
Blah.txt
vcc = 2.6, clock = 1.5 Mhz
vcc = 2.7, clock = 1.6 Mhz
vcc = 2.8, clock = 1.7 Mhz
vcc = 2.9, clock = 1.8 Mhz
All I want to do is read the file in Python and parse out the vcc and clock numbers.
fileInput = open('blah.txt', 'r')
for line in fileInput:
m = re.match("vcc:(.*)", line)
if m > -1:
##How to get value of vcc and clock here?
How would I get the value of vcc and clock in my code? For instance, for the first time my program runs through the file I just want to get out the vcc and clock info(2.6, 1.5).