Re: [Tutor] Accessing Specific Dictionary items

2011-08-01 Thread bob gailer
On 8/1/2011 8:34 PM, Mike Nickey wrote: [snip] [{'city': 'Buena Park', 'region_name': 'CA', 'area_code': 714}, {'city': 'Wallingford', 'region_name': 'CT', 'area_code': 203}, {'city': 'Schenectady', 'region_name': 'NY', 'area_code': 518}, {'city': 'Athens', 'region_name': '35'}] IMHO this is

Re: [Tutor] Accessing Specific Dictionary items

2011-08-01 Thread Mike Nickey
to a variable > > Or you can append to a list directly. > > l = [] > > for d in yourdict: >     l.append(d['city']) > > > Sent from my Verizon Wireless BlackBerry > > -Original Message- > From: Mike Nickey > Sender: tutor-bounces+eire1130=gmail.

Re: [Tutor] Accessing Specific Dictionary items

2011-08-01 Thread eire1130
irectly. l = [] for d in yourdict: l.append(d['city']) Sent from my Verizon Wireless BlackBerry -Original Message- From: Mike Nickey Sender: tutor-bounces+eire1130=gmail@python.org Date: Mon, 1 Aug 2011 15:26:32 To: ian douglas Cc: Subject: Re: [Tutor] Accessing Speci

Re: [Tutor] Accessing Specific Dictionary items

2011-08-01 Thread Steven D'Aprano
Mike Nickey wrote: The input being used is through pygeoip. Using this I am pulling the data by IP and from what I am reading this populates as a dictionary. Here is some of the output that I can show currently [{'city': 'Buena Park', 'region_name': 'CA', 'area_code': 714}, {'city': 'Wallingford

Re: [Tutor] Accessing Specific Dictionary items

2011-08-01 Thread Mike Nickey
The input being used is through pygeoip. Using this I am pulling the data by IP and from what I am reading this populates as a dictionary. Here is some of the output that I can show currently [{'city': 'Buena Park', 'region_name': 'CA', 'area_code': 714}, {'city': 'Wallingford', 'region_name': 'CT

Re: [Tutor] Accessing Specific Dictionary items

2011-08-01 Thread ian douglas
On 08/01/2011 03:05 PM, Mike Nickey wrote: Hi all, I'm trying to access and use specific items within a dictionary that is returned but am having issues in doing so. [{'city': 'Sunnyvale', 'region_name': 'CA', 'area_code': 408, 'metro_code': 'Santa Clara, CA', 'country_name': 'United States'}]

Re: [Tutor] Accessing Specific Dictionary items

2011-08-01 Thread eire1130
ct: [Tutor] Accessing Specific Dictionary items Hi all, I'm trying to access and use specific items within a dictionary that is returned but am having issues in doing so. [{'city': 'Sunnyvale', 'region_name': 'CA', 'area_code': 408, 'metro_

[Tutor] Accessing Specific Dictionary items

2011-08-01 Thread Mike Nickey
Hi all, I'm trying to access and use specific items within a dictionary that is returned but am having issues in doing so. [{'city': 'Sunnyvale', 'region_name': 'CA', 'area_code': 408, 'metro_code': 'Santa Clara, CA', 'country_name': 'United States'}] How can I populate a list of many different r