ctypes: return a pointer to a struct

sturlamolden sturlamolden at yahoo.no
Fri Apr 25 05:50:52 CEST 2008


On Apr 25, 5:39 am, "Jack" <nos... at invalid.com> wrote:

> IP2Location_get_all.restype = POINTER(IP2LocationRecord)
> IP2LocationObj = IP2Location_open(thisdir + '/IP-COUNTRY-SAMPLE.BIN')
> rec = IP2Location_get_all(IP2LocationObj, '64.233.167.99')
> print rec.country_short

print rec.contents.country_short



More information about the Python-list mailing list