On 06/01/14 08:57, Amrita Kumari wrote:
up to this extent it is ok; it is ok it is giving the output as:['1' , ' GLY' , 'HA2=3.7850' , 'HA3=3.9130' , ' ' , ' ' , ' ' , ' '] [ '2' , 'SER' , 'H=8.8500' , 'HA=4.3370' , 'N=115.7570' , ' ' , ' ' , ' '] ---------------------- ----------------------------------- but the command : key, value = row[2].split('=', 1) value = float(value.strip()) print(value) is giving the value of row[2] element as ['1' , ' GLY' , 'HA2=3.7850' , 'HA3=3.9130' , ' ' , ' ' , ' ' , ' '] 3.7850
Which is correct...
so this is not what I want I want to print all the chemical shift value of similar atom from each row at one time like this: 1 HA2=3.7850
Which is a combination of the values available to you. row[0], key, '=', value So you can put that together in a print as print (row[0], key, '=', value)
similarly, for atom HA3:
I didn't look at the original data in enough fetail to know if thats a trivial addition or more. But can you get the above formatting first?
so how to split each item into a key and a numeric value
Steven showed you that, you just needed to stitch the bits together in your desired format.
and then search for similar atom and print its chemical shift value at one time along with residue no..
Let's solve one problem at a time... HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
