Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98565

Re: Extracting and summing student scores from a JSON file using Python 2.7.10

X-Received by 10.66.222.169 with SMTP id qn9mr831003pac.4.1447117955876; Mon, 09 Nov 2015 17:12:35 -0800 (PST)
X-Received by 10.50.221.40 with SMTP id qb8mr397781igc.8.1447117955840; Mon, 09 Nov 2015 17:12:35 -0800 (PST)
Path csiph.com!xmission!news.glorb.com!i2no1322175igv.0!news-out.google.com!fs1ni4451igb.0!nntp.google.com!i2no2034056igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Mon, 9 Nov 2015 17:12:35 -0800 (PST)
In-Reply-To <mailman.194.1447115400.16136.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=24.156.194.39; posting-account=2kx5rQoAAADfvhMF5mfrfeFIzRuNA8Wb
NNTP-Posting-Host 24.156.194.39
References <1d1610e5-d401-48f2-b5ee-3af91b9e485f@googlegroups.com> <mailman.194.1447115400.16136.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <a5ad1e84-cd46-44b7-a7d4-ed0f9b74ec92@googlegroups.com> (permalink)
Subject Re: Extracting and summing student scores from a JSON file using Python 2.7.10
From Bernie Lazlo <bjlazlo@gmail.com>
Injection-Date Tue, 10 Nov 2015 01:12:35 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:98565

Show key headers only | View raw


On Monday, 9 November 2015 19:30:23 UTC-5, MRAB  wrote:
> On 2015-11-09 23:52, Bernie Lazlo wrote:
> > This should be a simple problem but I have wasted hours on it. Any help would be appreciated. [I have taken my code back to almost the very beginning.]
> > ========================
> > The student scores need to be summed.
> > ========================
> > import json
> > import urllib
> > url = "http://www.wickson.net/geography_assignment.json"
> > response = urllib.urlopen(url)
> > data = json.loads(response.read())
> > lst1 = list(data.items())
> > print lst1
> >
> Do it a step at a time.
> 
> It's a list, so start with indexing.

MRAB:

I think of the file as two lists. The second list appears to be a list of tuples containing "names" and "scores". How would you index or extract those.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Extracting and summing student scores from a JSON file using Python 2.7.10 Bernie Lazlo <bjlazlo@gmail.com> - 2015-11-09 15:52 -0800
  Re: Extracting and summing student scores from a JSON file using Python 2.7.10 MRAB <python@mrabarnett.plus.com> - 2015-11-10 00:29 +0000
    Re: Extracting and summing student scores from a JSON file using Python 2.7.10 Bernie Lazlo <bjlazlo@gmail.com> - 2015-11-09 17:12 -0800
      Re: Extracting and summing student scores from a JSON file using Python 2.7.10 MRAB <python@mrabarnett.plus.com> - 2015-11-10 01:31 +0000
        Re: Extracting and summing student scores from a JSON file using Python 2.7.10 Bernie Lazlo <bjlazlo@gmail.com> - 2015-11-09 17:53 -0800
          Re: Extracting and summing student scores from a JSON file using Python 2.7.10 MRAB <python@mrabarnett.plus.com> - 2015-11-10 02:13 +0000
      Re: Extracting and summing student scores from a JSON file using Python 2.7.10 Pete Dowdell <contact@stridebird.com> - 2015-11-10 09:38 +0700
  Re: Extracting and summing student scores from a JSON file using Python 2.7.10 Bernie Lazlo <bjlazlo@gmail.com> - 2015-11-09 19:21 -0800
  Re: Extracting and summing student scores from a JSON file using Python 2.7.10 Denis McMahon <denismfmcmahon@gmail.com> - 2015-11-10 03:25 +0000
    Re: Extracting and summing student scores from a JSON file using Python 2.7.10 wayne.wickson@gmail.com - 2015-11-09 19:53 -0800
      Re: Extracting and summing student scores from a JSON file using Python 2.7.10 Bernie Lazlo <bjlazlo@gmail.com> - 2015-11-10 04:14 -0800
  Re: Extracting and summing student scores from a JSON file using Python 2.7.10 Bernie Lazlo <bjlazlo@gmail.com> - 2015-11-10 04:16 -0800

csiph-web