Skip to content

Tag: python

How to print fp in HTTPError?

After seeing this error with my urlopen() function: I wrote a catch exception, but fp is empty when I printed it out. Any ideas? Output: fp isn’t empty in the HTTPError class Output: Thanks. Answer Perhaps I’m dense; but a few items that might help you. You have an errant ” in your print(&#8…

Python BeautifulSoup4 news scraper giving odd error

I am trying to make a news scraper with BS4 and I am able to get the html code from the website (cnn) and this is my code: but its giving me this error I have no idea what is causing this, Thanks! Answer If the string topic is not found on the page, then prices will be an empty