[Tutor] how to get blank value

Alan Gauld alan.gauld at btinternet.com
Fri Jul 24 10:26:51 CEST 2009


<amrita at iisermohali.ac.in> wrote

> 48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50
> 104 ALA H = 7.70 N =  CA =  HA = 4.21 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,
>
> I tried in this way:
> import re
> expr = re.compile("C = None")

This will search for the literal string 'C = None' which does not exist in 
your sdata.
You need to search for 'C = 'at the end of the line (assuming it is always 
there.
Otherwise you need to search for 'C = ' followed by a non number.)

HTH,

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




More information about the Tutor mailing list