[Tutor] How to calculate high value from multiple lines for each column
Alan Gauld
alan.gauld at btinternet.com
Sat Feb 27 19:30:26 EST 2016
On 27/02/16 15:46, Fosiul Alam wrote:
> a) Can I combile 2 forloop into one ?
Yes of course.
for key in values:
print "svtm-%s ,%s" % (key, values[key][0])
print "iostat-%s ,%s" % (key, values[key][1])
> b) How can remove first value from for loop - step a ?
> print "Remove First value", values['dm-30'][0].pop(0)
> print "SVTM DM30: ", max(values['dm-30'][0])
Instead of using pop() you can use slicing with [1:]:
print "SVTM DM30: ", max(values['dm-30'][0][1:])
print "IOSTAT DM-30",max(values['dm-30'][1][1:])
Does it all in one go.
--
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
More information about the Tutor
mailing list