zoukankan      html  css  js  c++  java
  • 《零基础入门学习Python》学习过程笔记【53如何用Python访问互联网】

    urllib是包

    模块在包中

    函数在模块中

    urllib=url(网页地址)+lib(library)

    URL由三部分组成  协议://路径/文件

    协议,例如:http

    http默认端口号为80


    1.如何访问互联网?

    import  urllib.request  #导入request模块

    response=urllib.request.urlopen("http://网页")  #打开网页,并获得网页类的对象

    html=response.read() 读取网页

    #print(html) 会输出2进制版的html代码

    html=html.decode("utf-8")  #解码为utf-8

    #print(html)这时候会输出网页的html代码





  • 相关阅读:
    leetcode931
    leetcode1289
    leetcode1286
    poj Meteor Shower
    noip杂题题解
    noip2007部分题
    NOIP Mayan游戏
    某模拟题题解
    codevs 1423 骑士
    noip 邮票面值设计
  • 原文地址:https://www.cnblogs.com/iamjuruo/p/7470877.html
Copyright © 2011-2022 走看看