2013-10-18 6 views
0

파이썬 2.6에서 어떻게 버퍼에 액세스 할 수 있습니까? arcpy를 통해 외부 Python 클래스를 사용하여 PostgreSQL 데이터베이스 함수에 액세스하고 있습니다.파이썬 2.6에서 버퍼 읽기

# 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'> 

감사합니다.

답변

1

buffer은 다른 시퀀스와 마찬가지로 슬라이스되거나 반복 될 수 있습니다.

>>> 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 
+0

고맙습니다. 나는이 문제를 해결하기 위해 여러 가지 문제를 해결하기 위해 노력했으며 코드의이 부분이 맞는지 확인하기 위해 온 전성 검사가 필요했습니다. 다시 한번 감사드립니다. – Matt