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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -