python - Scraping data and inputting it into two different tables -
i have scraped squad data following website: http://www.espnfc.us/club/real-madrid/86/squad
i created dictionary each player , wondering if can save goalkeeper data in different file outfield players data
for i'm using following code input data 1 output file
without knowing how data structured, it's hard help.
if data
list of dicts, 1 each player, elements describing each column in web table, use list comprehensions filter position:
with open('goalkeepers.json','wb') goalkeeper_file: json.dump( [player player in data if player['pos'] == "g"], goalkeeper_file) open('outfielders.json','wb') outfield_file: json.dump( [player player in data if player['pos'] != "g"], outfield_file)
Comments
Post a Comment