0

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.

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I've been working on this for several issues and needed a sanity check to confirm that this part of my code was correct! Thanks again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.