So if I wanted to print the contents of a url page or just cycle through many and only change a few segments of the URL how might I do so. Given the following:
If I know the format will usually be the following for any player, minus a few tweeks to the ID and last portion: Format below:
http://espn.go.com/mlb/player/_/id/31000/brad-brach
Lets say I know each players ID and name:
PLAYER_NAME = ['brad-brach','oliver-drake',...]
PLAYER_ID = ['31000','31615',...]
for i in PLAYER_ID:
url = 'http://espn.go.com/mlb/player/_/id/'+PLAYER_ID[i]+/'+PLAYER_NAME[i]
Do what ever given that we know all these players in the PLAYER_ID and PLAYER_NAME.
How might I iterate through all the PLAYER_ID's and PLAYER_NAME's without getting a
TypeError: list indices must be integers, not str
I know that url is a list and the contents within it PLAYER_ID[0] would be a string. What am I missing here?
PLAYER_NAMESandPLAYER_IDSwould be better names for collections.