Trying python after a very long time now.
I have a file that has a line:
My_NUMBER = 24
I want to extract this number ( here I have assumed 24 but this is something I want to extract based on My_NUMBER.In my python code I am able to read the line
with open(filename) as f: lines = f.read().splitlines()
for line in lines:
if line.startswith(' My_NUMBER ='):
line=(line.rsplit(' ', 1)[0])
num= line.rsplit('=',1)[1].split("=")[0]
num = num.strip(" ")
print num
However this does print blank output and not the number. Can anyone commet in case I am doing anything obviously wrong here?