Need to remove list items that do not produce a json from for loop
list1 = [items]
list2 = []
for item in list:
df = pd.DataFrame()
try:
df = pd.read_json('https://blahblahblah/'+item+'/blah')
if Exception:
list1.remove(item) ###I want to remove broken items so list1 and list2 are same length
except Exception: pass
newitem = (jsonthing/jsonthing)
list2.append(newitem)
Aucun commentaire:
Enregistrer un commentaire