Python error __python about Urllib.request.urlopen ()

Source: Internet
Author: User

There was an error in using Pycharm compilation when you first learned that Python is ready to learn a reptile

This is the source code:

#!usr/bin/python
import urllib.request
url = "http://www.baidu.com" Get
= Urllib.request.urlopen (URL). Read ()
print (GET)

This is inherently simple, but the following error occurred:

C:\Programming\Python\WeChat\venv\Scripts\python.exe c:/programming/python/learning/spiderlearning.py
Traceback (most recent call last):
File "c:/programming/python/learning/spiderlearning.py", line 2, in <module>
Import Urllib.request
File "C:\Users\16689\AppData\Local\Programs\Python\Python36\Lib\urllib\request.py", line <module>
Import Http.client
Modulenotfounderror:no module named ' Http.client '; ' HTTP ' is not a package

I find it baffling, finally found that I have a http.py file under the Unified folder, but it is strange that I run http.py can run successfully


This should be the error caused by the keyword sensitivity. Delete this file, modify the file name and then you can run normally.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.