zoukankan      html  css  js  c++  java
  • Web crawler study(1)

    1. setup the python3 enviromemt via download the excuted files from the website https://www.python.org/downloads/

    2.Atfer seting up ,confirm that whether the enviroment is successful or not .

       open the CMD windows  /  Linux terminal  to type "python" ,then press the enter  key.

    3.create a python file for coding.eg :demo.py

      # coding=gbk                                      #it can be avoid the syntaxerror:non-utf-8 code starting with x3
      

          import urllib.request                             # urllib.request  is a package which usally used to get the infomation form the web pages
       
      url="http://www.baidu.com"                  # the web site that we want to get the information from it

      response=urllib.request.urlopen(url)      # get the reponse from the web server,the expected result is the information  that we wanted.
     
      html=response.read()                          # return the information the Binary string,so that the infromation can be displayed.
     
      codeOfHtml=html.decode('utf-8')          #decoding the information
     
      print(codeOfHtml)                                #print the information

    4. Run the demo.py script

  • 相关阅读:
    Linux下Oracle client客户端安装
    深度学习的batch_size
    Ubuntu下CUDA8.0卸载
    Numpy 定义矩阵的方法
    python 按照自然数排序遍历文件 python os.listdir sort by natural sorting
    linux 将终端进行换行
    从LeNet到SENet——卷积神经网络回顾
    神经网络权值初始化方法-Xavier
    FaceAlignment blog
    tensorflow模型量化压缩
  • 原文地址:https://www.cnblogs.com/yongdaiblog-201409/p/6731056.html
Copyright © 2011-2022 走看看