<amr...@iisermohali.ac.in> wrote

Sorry to say, but till now I have not got the solution of my problem, I
tried with this command:-

import re

if __name__ == '__main__':
    data = open('chem.txt').readlines()
    for line in data:
        RE = re.compile('C = (.)',re.M)

The regex still does not match the end of line.
The regex character for end of line is $ thus you should find something like

        RE = re.compile('C =$')

You might need to allow for whitespace between the = and $...

If the blanks are not at the end of the line things get slightly more
complicated

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to