try (using f-string (if your python 3.6 or newer)):
for id in id_list: with open(f'location{id}') as fp: data = json.load(fp)if using python 3 older than 3.6 use:
for id in id_list: with open(f'location{}'.format(id)) as fp: data = json.load(fp)FYI: please use 4 space indentation