[Tutor] how to get blank value

bob gailer bgailer at gmail.com
Tue Jul 28 19:22:19 CEST 2009


amrita at iisermohali.ac.in wrote:
> It is not giving any value, without any error
>
> ph08001 at sys53:~> python trial.py
> ph08001 at sys53:~>
> it is coming out from shell.
>   
Try this. I embedded the test data to simplify testing:

data = """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 =""".split('\n')
for line in data:
    line2 = line.split('=')
    if not line2[5]: # C value missing
      if len(line2[2]) <= 5 and len(line2[3]) <= 5: # N and CA values 
missing
        print "all missing", line
      else:
        print "C missing", line

-- 
Bob Gailer
Chapel Hill NC
919-636-4239


More information about the Tutor mailing list