>>>>> amr...@iisermohali.ac.in (a) a écrit: >a> Hi,
>a> I have a file having lines:- >a> 48 ALA H = 8.33 N = 120.77 CA = 55.18 HA = 4.12 C = 181.50 >a> 104 ALA H = 7.70 N = 121.21 CA = 54.32 HA = 4.21 C = >a> 85 ALA H = 8.60 N = CA = HA = 4.65 C = >a> Now i want to make two another file in which i want to put those lines for >a> which C is missing and another one for which N,CA and C all are missing, >a> I tried in this way: >a> import re >a> f = open('chem.txt') >a> for line in f: >a> if re.search('C = ',''): >a> print line >a> but i am not getting the desired output. You never look in the lines you read. if re.search('C = ',''): should be if re.search('C = ', line): Do you really think before you write your code? Or look at it after you have written it? Sorry if I offend you but you give the impression of just trying some more or less random stuff and then asking here if it doesn't give the required result. That's not the attitude of a researcher, unless your definition of research is 'asking on Usenet'. -- Piet van Oostrum <p...@cs.uu.nl> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list