[GRASS-user] Re: Feed and manipulate the result of "v.distance -pa"
in python
schorschli
matthiasoswald at hotmail.com
Wed Aug 4 09:20:58 EDT 2010
For your task the use of lists and the split tool may help.
The different lines have are seperated by a '\n' (which is interpreted as a
new line). After splitting the string into a line list you can make a loop
each item of this list. Something like this:
output='7839|16\n7839|17\n7839|22\n7839|23\n7839|24'
seccond_column_list=[]
max_value=0
line_list=output.split('\n')
for line in line_list:
columns=line.split('|')
seccond_column_list.append(float(columns[1]))
max_value=max(seccond_column_list)
print seccond_column_list
print max_value
I may missunderstood your question but I hope this helps.
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Feed-and-manipulate-the-result-of-v-distance-pa-in-python-tp5371195p5372457.html
Sent from the Grass - Users mailing list archive at Nabble.com.
More information about the grass-user
mailing list