import csv
# csv.reader interface
po_names = set()
with open("data/ri.csv","rt",newline="") as csvfile:
rdr = csv.reader(csvfile)
for row in rdr:
name = row[3] # ??? what is this?
if name:
po_names.add(name)
# csv.DictReader interface
po_names = set()
with open("data/ri.csv","rt",newline="") as csvfile:
rdr = csv.DictReader(csvfile)
for row in rdr:
name = row["PO Name"] # much clearer
if name:
po_names.add(name)
po_names
import json
with open("data/nasa_earth_assets.json","rt") as jsonfile:
val = json.load(jsonfile)
type(val)
val["resource"]
# Check that this is terrestrial imagery
val["resource"]["planet"] == "earth"
# The lines below are not expected to work, but they are the kinds
# of queries you might use to explore an object returned from
# reading a JSON file.
d["metadata"]["date"]
d["metadata"]["version"]
d["response"]["scores"]["quiz7"]