frozensets

This is the place for queries that don't fit in any of the other categories.

frozensets

Postby pcoder » Fri Sep 30, 2016 2:00 pm

Here is the code I am testing.

Code: Select all
>>> from geoip import geolite2
>>> match = geolite2.lookup('17.0.0.1')
>>> match is not None
True
>>> match.country
'US'
>>> match.continent
'NA'
>>> match.timezone
'America/Los_Angeles'
>>> match.subdivisions
frozenset(['CA'])


How do I just get CA out of the frozenset because when I save this in a variable and print it it shows frozenset(['CA'])

Code: Select all
>>> a = match.subdivisions
>>> print(a)
frozenset(['CA'])
>>>
pcoder
 
Posts: 25
Joined: Wed Jun 04, 2014 4:21 pm

Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 7 guests

cron