lundi 2 décembre 2019

Web-scraping URL Construction

Consider the URL :

https://en.wikipedia.org/wiki/NGC_2808

When I use this directly as my url in temp = requests.get(url).text everything works alright.

Now, consider the string name = NGC2808. Now, when I do s = name[:3] + '_' + name[3:] and then do url = 'https://en.wikipedia.org/wiki/' + s ,the program doesn't work anymore.

Why does this happen?




Aucun commentaire:

Enregistrer un commentaire