Re: [Tutor] just one question

2009-07-16 Thread amrita
Thankyou very much sir now it is working..it is giving that result which i wanted. Thankyou very much.. Thanks, Amrita > Please use reply-all, so that emails go to the list as well. > > 2009/7/16 : >> Thankyou for help it is working and giving the result but the only >> problem >

Re: [Tutor] just one question

2009-07-16 Thread Rich Lovely
Please use reply-all, so that emails go to the list as well. 2009/7/16 : > Thankyou for help it is working and giving the result but the only problem > is that it is making a very big file as it is searching for each position > of ALA and first writting its C value then CA then CB like that, is i

Re: [Tutor] just one question

2009-07-16 Thread Rich Lovely
2009/7/16 : > Thanks for your help I tried your commands like:--- > > from __future__ import with_statement #only works on version 2.5 and later > from collections import defaultdict > from decimal import Decimal > > atoms = defaultdict(dict) > > with open("file1.txt") as f: >    for line in f: >

Re: [Tutor] just one question

2009-07-15 Thread wesley chun
On Wed, Jul 15, 2009 at 8:29 AM, Rich Lovely wrote: > 2009/7/15 vince spicer : >>: >> import re >>: >>     values = re.split("\s+", line) # split values on spaces EX: ['47', '8', > > That isn't what they're after at all. > Something more like > : >        n, pos, ala, at, sy

Re: [Tutor] just one question

2009-07-15 Thread Rich Lovely
2009/7/15 vince spicer : > one way is: > > import re > > infile = open("test.txt", "r") #: open read mode > outfile = open("out.tx", "w") #: open write mode > > for line in infile: >     values = re.split("\s+", line) # split values on spaces EX: ['47', '8', > 'ALA', 'H', 'H', '7.85', '0.02', '1']

Re: [Tutor] just one question

2009-07-15 Thread vince spicer
one way is: import re infile = open("test.txt", "r") #: open read mode outfile = open("out.tx", "w") #: open write mode for line in infile: values = re.split("\s+", line) # split values on spaces EX: ['47', '8', 'ALA', 'H', 'H', '7.85', '0.02', '1'] outfile.write("%s %s C = %s CA = %

[Tutor] just one question

2009-07-15 Thread amrita
Hi, i want to ask one thing that suppose i have a .txt file having content like:--- 47 8 ALA H H 7.85 0.02 1 48 8 ALA HAH 2.98 0.02 1 49 8 ALA HBH 1.05 0.02 1 50 8 ALA C C179.39 0.