Question

In Python 2.6, how can I access a buffer? I'm using an external python class via arcpy to access a PostgreSQL database function.

# the_geom is part of a list.
print the_list
# Returns:... 'the_geom': <read-only buffer for 0x06E4FB60, size 1997, offset 0 at 0x34BCCB80>,...

for item in the_list:
    the_geom=item['the_geom']
    print(type(the_geom))
    # Returns: <type 'buffer'>

Thanks.

Était-ce utile?

La solution

buffers can be sliced or iterated, just like other sequences.

>>> buffer('foobar')
<read-only buffer for 0x7fcdd7caa120, size -1, offset 0 at 0x7fcdd7ca82f0>
>>> buffer('foobar')[3:5]
'ba'
>>> for c in buffer('foobar'):
...   print c
... 
f
o
o
b
a
r
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top