You may like to have a look @ pyparsing module.
URL: http://pyparsing.wikispaces.com/

HTH.
regards,
shantanoo

On 29-Jul-09, at 1:03 AM, amr...@iisermohali.ac.in wrote:

with these data it is giving output but when I tried

if __name__ == '__main__':
data = open('chem.txt').readlines()
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

by putting data in .txt file then it is not giving output. Actually I have few large data file what I want that I will put those lines in one file for which only C value is missing and in another one I will put those line
for which N, CA and C all values are missing.

Thanks for help.
Amrita

amr...@iisermohali.ac.in wrote:
It is not giving any value, without any error

ph08...@sys53:~> python trial.py
ph08...@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



Amrita Kumari
Research Fellow
IISER Mohali
Chandigarh
INDIA

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

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

Reply via email to