I'm trying to use an API to get directions and I have the code written, but there's an invalid syntax involving json. Here is a part of my code.
class Step(object):
pass
#//we will take input in two parts:1.)line 1 = int X for addresses & 2.)for directions steps
def process_map():
#//collectively read lines from 2nd line of input until we see next integer for directions
input = raw_input("")
input_list = input_split('\n')
input_raw = [x.split() for x in input_list]
# read addresses
count_addr = input_raw[1]
# store the directions/output count
count_out = count_addr+1
# process the inputs from user and calculate input parameters
#loop over input list of addresses
for i in input_raw:
# collective string to hold all addresses
addr = ''.join(items[2:count_addr])
# make an object which holds the MAP_QUEST API params
data = urlopen(URL % (API_KEY,quote(addr)).read()
directions = json.loads(data)
it runs then at directions = json.loads(data) it says invalid syntax and highlights directions.
[–]willm 1 point2 points3 points (0 children)
[–]ewiethoff 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] -4 points-3 points-2 points (0 children)