Looks like your accessing a list as a dict. Look at the raw data, something
is a list (ie something[0] not some["thing"])

Robert
On Jul 4, 2011 5:44 PM, "Divyahans" <[email protected]> wrote:
> Hi,
>
> I'm just starting out with Python and was working with the Directions
> API. I wanted to parse the JSON it returns to get directions(in
> "html_instructions").
>
> Here is my code:
>
> url = DIRECTIONS_BASE_URL + '?' + urllib.urlencode(direct_args)
> result = json.load(urllib.urlopen(url))
> str = json.dumps([x['legs']['steps']['html_instructions'] for x in
> result['routes']])
>
> I receive the error: TypeError: list indices must be integers, not str
>
> I'm pretty sure the error is in the third line, but I can't see what
> is wrong.
>
> Please reply.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
[email protected].
> For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to