免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4343 | 回复: 5
打印 上一主题 下一主题

python3.2 http.client.HTTPConnection()报错 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-08-27 19:36 |只看该作者 |倒序浏览
本帖最后由 jjwspj 于 2012-08-27 19:37 编辑

我用http.client.HTTPConnection()在python下报错“AttributeError: 'module' object has no attribute 'client'”,但ipython正常,请高人指点,感谢!
  1. bill131:~ # python3
  2. Python 3.2.2 (default, May  6 2012, 16:18:48)
  3. [GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> import  http
  6. >>> web_url="www.baidu.com"
  7. >>> http.client.HTTPConnection(web_url)
  8. Traceback (most recent call last):
  9.   File "<stdin>", line 1, in <module>
  10. AttributeError: 'module' object has no attribute 'client'
  11. >>>
复制代码
  1. In [1]: import http

  2. In [2]: web_url="www.baidu.com"

  3. In [3]: http.client.HTTPConnection(web_url)
  4. Out[3]: <http.client.HTTPConnection at 0x10d8510>

  5. In [4]:
复制代码

论坛徽章:
0
2 [报告]
发表于 2012-08-28 03:01 |只看该作者
本帖最后由 pastebt 于 2012-08-28 03:05 编辑

回复 1# jjwspj
  1. import http.client
复制代码

论坛徽章:
2
2015年迎新春徽章
日期:2015-03-04 09:55:28IT运维版块每日发帖之星
日期:2016-07-29 06:20:00
3 [报告]
发表于 2012-08-28 04:47 |只看该作者
你的ipython版本是多少?

论坛徽章:
0
4 [报告]
发表于 2012-08-28 12:53 |只看该作者
ning_lianjie 发表于 2012-08-28 04:47
你的ipython版本是多少?

我的ipython是0.12

论坛徽章:
0
5 [报告]
发表于 2012-08-28 13:05 |只看该作者
回复 2# pastebt
谢谢了,import  http为什么不包括http.client呢?


   

论坛徽章:
0
6 [报告]
发表于 2012-08-28 17:18 |只看该作者
回复 5# jjwspj


    2 到 3 这样的错误还多着呢,google下2和3的模块区别吧。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP