Unable to lookup keys in dictionary

Jerry Hill malaclypse2 at gmail.com
Tue Aug 12 18:17:57 CEST 2008


On Tue, Aug 12, 2008 at 11:27 AM, Matt Fielding (R* New England)
<Matt.Fielding at rockstarnewengland.com> wrote:
> [{'userName': 'mfielding', 'clientRoot': 'c:\\perforce', 'monitor':
> 'enabled',
> 'serverRoot': 'H:\\p4root\\', 'serverVersion': 'P4D/NTX64/2007.3/143793
> (2008/01/
> 21)', 'serverDate': '2008/08/12 11:18:56 -0400 Eastern Daylight Time',
> 'clientAd
> dress': '10.24.20.97:1918', 'serverLicense': 'Mad Doc Software, Inc. 140
> users (
> support expired 2008/05/31) ', 'serverAddress':
> 'rsgnwep4s1.rockstar.t2.corp:166
> 6', 'clientHost': 'nwew-mfielding', 'security': 'enabled', 'password':
> 'enabled'
> , 'clientName': 'mfielding'}]
>
> I did this to test that I was receiving a dictionary back from the server,
> which I clearly am.

That's not a dictionary.  Try adding print type(info) and you'll see
that what you have is a list containing one item: a dictionary.  So,
you may need to do something like:

info = info[0]
print info
s = info[serverVersion]
print s

-- 
Jerry



More information about the Python-list mailing list