zoukankan      html  css  js  c++  java
  • what have we learnt in day five

    what is file?

    virtual unit offered by operation system

    steps to open file

    1.find the file_path(file_path)

    2.open file(open)

    3.read or change the file(read/write)

    4.save the files(flush)

    5.close the file (close)

    three modes to open .txt file

    w:clear the file and write in

    r:can only read

    a:write in after the file

    two ways to open .txt file

    b:binary

    t:text

    you'd better not to use three ways below

    1.r+

    2.a+

    3.w+

    with in charge of the context

    f=open()
    f.read()
    #close file automaticly
    with open() as f
         f.read()
    

    principle of crawler

    send requests through explore to get files,through requests module analog browser gets content

    process of crawler

    1.send requests(filling url)

    2.get context

    3.choose the value you need

    use of requests module

    import requests
    res=requests.get(url)
    #wenben
    res.txt
    #erjinzhiliu
    res.content
    

    re module

    re.S search all

    re.findall() choose what you need in the context

    if you need anything just(.*?)

  • 相关阅读:
    检测mysq组复制的脚本
    centos7安装NFS
    mysql组复制安装
    springboot+VUE(一)
    redis集群配置
    codevs 3139 栈练习3
    codevs 3138 栈练习2
    codevs 2622 数字序列
    codevs 1054 电梯
    codevs 1507 酒厂选址
  • 原文地址:https://www.cnblogs.com/jimGraymane/p/11425882.html
Copyright © 2011-2022 走看看