Hi Alan Thanks for the reply, so bellow is the code, hope this is right ,
here 2 issues, i am having , not sure where i am doing wrong. really sorry if i am doing something very silly . 1) the final data out put only has one values dm-31 but dm-30 is missing. 2) I need to assoicated values with dm name example dm-30 and dm-31 as final result . Thanks for your help . for line in dm_data: fields= line.split() print fields data = values.setdefault(fields[0],[ [],[] ]) # return print data print "===" data[0].append(float(fields[10])) data[1].append(float(fields[11])) print "------" print data bellow is the out put ['dm-30', '1.47', '36.48', '2.82', '0.66', '270.84', '148.56', '240.96', '0.06', '44.99', '18.27', '6.36'] [[], []] === ['dm-31', '1.47', '36.49', '2.82', '0.66', '270.85', '148.58', '240.94', '0.06', '45.03', '18.28', '6.37'] [[], []] === ['dm-30', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '2.00', '1.00'] [[18.27], [6.3600000000000003]] === ['dm-31', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '3.00', '1.50'] [[18.280000000000001], [6.3700000000000001]] === ['dm-30', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.40', '0.50'] [[18.27, 2.0], [6.3600000000000003, 1.0]] === ['dm-31', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.70', '0.60'] [[18.280000000000001, 3.0], [6.3700000000000001, 1.5]] === ------ [[18.280000000000001, 3.0, 0.69999999999999996], [6.3700000000000001, 1.5, 0.59999999999999998]] On Thu, Feb 25, 2016 at 10:04 PM, Alan Gauld <alan.ga...@btinternet.com> wrote: > On 25/02/16 20:44, Fosiul Alam wrote: > > how ami I gettign the "values" ? as its not defiend > > anywhere, so how we putting data into variables "values" ? > > Look more closely at my previous post. > > > >>> s_value= dict() > >>> u_value=dict() > >>> > >> > >> You don't need two variables here, just one will do, lets just call it > >> values. > > > >> data = values.setdefault(fields[0],[ [],[] ]) > >> data[0],append(float(fields[10]) > >> data[1],append(float(fields[11]) > > HTH > > -- > Alan G > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > http://www.amazon.com/author/alan_gauld > Follow my photo-blog on Flickr at: > http://www.flickr.com/photos/alangauldphotos > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- Regards Fosiul Alam _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor