Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 

29 rader
990 B

#!/usr/bin/env python3
#title :11-2.py
#description :11.2: JSON-stationslijsten lezen
#author :Marcel Haazen
#email :marcel@haazen.xyz
#date :07-11-2019 - 13:45
#edit_date :07-11-2019 - 14:05
#version :0.1
#usage :python3 11-2.py
#notes :
#python_version :3.7.4
#==============================================================================
import json
with open("stationslijst.json", "r") as json_file:
data = json.load(json_file)
lng = []
print("Dit zijn de namen, codes en types van de stations:")
for station in data["payload"]:
name = station["namen"]["lang"]
code = station["code"]
st = station["stationType"]
lng.append(station['lng'])
print("{:25} - {:5} : {:5}".format(name, code, st))
for station in data["payload"]:
if station["lng"] == max(lng):
print("\nHet meest oostelijke gelegen station is:", station["namen"]["lang"])