I would check the way your accessing your list
xylist[0][1] is the way I do it
Or is your way the new Python 3.1.1 way of doing things
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
Open python's interpreter and type this. Do you get an error?
mylist = [[1,2],[3,4]]
print float(mylist[0][0])
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
just saw the extra ] and that was it... oh the joy
Thanks for the help
I also have to create a function to determine the minimum bounding rectangle of this polygon (which is just the Xmin, Ymin, Xmax, Ymax). I see how it would be easy to do if I had the X and Y coordinates in separate lists by just using xyList.sort. Is there a similar way to sort a nested list based on the first variable (x) and then for the second (y)?
I think you answered your own question, copy the x values to a list - sort and copy the y values to another list - sort and you have your max and min values
or
You could try the map function with a lambda function to achieve this
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
>>> x = 813367.216157178627327
>>> x
813367.21615717863
>>> b = '%.2f' % x
>>> b
'813367.22'
>>> f = open('poly.txt', 'w')
>>> f.write(b)
>>> f.close()
>>> a = open('poly.txt', 'r')
>>> a.read()
'813367.22'
>>>
snippsat
Practically a Posting Shark
808 posts since Aug 2008
Reputation Points: 353
Solved Threads: 294