[Tutor] how to get blank value

amrita at iisermohali.ac.in amrita at iisermohali.ac.in
Sat Jul 25 16:41:47 CEST 2009


Hi,

I have a file having lines:-

48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50
104 ALA H = 7.70 N = 121.21 CA = 54.32 HA = 4.21 C =
85 ALA H = 8.60 N =  CA =  HA = 4.65 C =

Now i want to make two another file in which i want to put those lines for
which C is missing and another one for which N,CA and C all are missing,

With these commands:-

import re
f = open('chem.txt')
for line in f:
     if re.search('C = ',line):
        print line

I am getting those lines for which C value is there but how to get those
one for which it doesn't have any value, i did google search but still i
am not getting.

Amrita Kumari
Research Fellow
IISER Mohali
Chandigarh
INDIA



More information about the Tutor mailing list