zoukankan      html  css  js  c++  java
  • Python3 urllib 与 Python2 urllib的变化

    Infi-chu:

    http://www.cnblogs.com/Infi-chu/

    Py2.x:

      Urllib

      Urllin2

    Py3.x:

      Urllib

    变化:

    1. 在Pytho2.x中使用import urllib2——-对应的,在Python3.x中会使用import urllib.requesturllib.error
    2. 在Pytho2.x中使用import urllib——-对应的,在Python3.x中会使用import urllib.requesturllib.errorurllib.parse
    3. 在Pytho2.x中使用import urlparse——-对应的,在Python3.x中会使用import urllib.parse
    4. 在Pytho2.x中使用import urlopen——-对应的,在Python3.x中会使用import urllib.request.urlopen
    5. 在Pytho2.x中使用import urlencode——-对应的,在Python3.x中会使用import urllib.parse.urlencode
    6. 在Pytho2.x中使用import urllib.quote——-对应的,在Python3.x中会使用import urllib.request.quote
    7. 在Pytho2.x中使用cookielib.CookieJar——-对应的,在Python3.x中会使用http.CookieJar
    8. 在Pytho2.x中使用urllib2.Request——-对应的,在Python3.x中会使用urllib.request.Request
  • 相关阅读:
    app测试点-1
    毕业5年的感悟
    关于游戏外挂
    python-unittest单元测试框架
    python-requests
    http简介
    python基础-发邮件smtp
    python-加密
    4 Python 日期和时间
    5 Python 数据类型—数字
  • 原文地址:https://www.cnblogs.com/Infi-chu/p/9628849.html
Copyright © 2011-2022 走看看