looping
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Nov 2 02:09:13 EDT 2007
En Fri, 02 Nov 2007 02:03:09 -0300, Beema shafreen
<beema.shafreen at gmail.com> escribió:
> hi everbody,
> i have a file ,
> A_16_P41851056 1730
> A_16_P03796992 165
> A_16_P21640222 360
> A_16_P21640223 240
> A_16_P03796998 205
> column 2 of my file has values.... 1730, 165,360....
> if i need to put a condition checking that if the first values is greater
> than the next i have to print the column coresponding to that.....
> say for example 1730 is greater than 165 so i print column1 value
> =A_16_P41851056 , but 165 is lesser that both the 1730 and 360 so i omit
> the
> value....from column1, and i have to continue the loop till the end of
> file
> checking which values is greater the both tom and bottom how do i do
> it.....
An easy way would be to use the csv module to read your data; then compare
rows [i] and [i+1]
--
Gabriel Genellina
More information about the Python-list
mailing list