errorCount = 0 for Dancer in Dancers_1: for Emotion in Emotions_1: Name = "{}_{}".format(Dancer, Emotion) URL = baseURL.replace('[NAME]', Name) try: r = requests.get(URL) with open('Downloaded_Data/{}.c3d'.format(Name), 'wb') as f: f.write(r.content) print('Downloaded {}'.format(Name)) except requests.exceptions.RequestException as e: print(e) print('Unable to Download {}'.format(URL)) errorCount += 1