What is the error?? | SoloLearn: Learn to code for FREE!

+1

What is the error??

https://code.sololearn.com/c7E2sFvdbJwe/?ref=app

5/8/2020 6:03:46 PM

Jayant Agarwal

6 Answers

New Answer

+2

Jayant Agarwal Your code is completely fine There is a small mistake You are using urllib.request but you haven't imported it Add it import urllib.request

+2

+1

Is your program running

+1

+1

from urllib.request import urlopen import webbrowser resp = urlopen('http://www.ted.com/') html = resp.read( ) data = resp.getcode( ) url = resp.geturl( ) hd = resp.headers inf = resp.info( ) print("the url is",url) print("HTTP status code is :",data) print("headers returned \n",hd) print("the info( ) returned :\n",inf) print("now opening the url",url) webbrowser.open_new(url) please use from urllib.request import urlopen. It's much cleaner.

0

use import urllib.request instead of import urllib