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(.*?)

what have we learnt in day five的更多相关文章

  1. [note]What I’ve learnt from working on startups

    What I've learnt from working on startups 从失败里学到了什么,六次创业失败. 企业家不是与生俱来的,也是靠学来的. 想的太多,做的太少.

  2. Today I learnt

    2015-May-22 In Oracle database, dropping a table don't free up the space directly. You'll need to di ...

  3. 学习笔记之三十年软件开发之路 - Things I Learnt The Hard Way (in 30 Years of Software Development)

    三十年软件开发之路 https://mp.weixin.qq.com/s/EgN-9bIHonRid1DM0csQDw https://blog.juliobiason.net/thoughts/th ...

  4. Lesson 17 Always young

    Text My aunt Jennifer is an actress. She must be at least thirty-five years old. In spit of this, sh ...

  5. Lesson 14 Do you speak English?

    Text I had an amusing experience last year. After I had left a small village in the south of France. ...

  6. How do servlets work-Instantiation, sessions, shared variables and multithreading[reproduced]

    When the servletcontainer (like Apache Tomcat) starts up, it will deploy and load all webapplication ...

  7. Usual tiny skills & solutions

    Ubuntu and Win10 - double OS 2016-02-21 Yesterday I helped my friend install Ubuntu (14.04 LTS) on h ...

  8. Sensitive directory/file Integrity Monitoring and Checking

    catalogue . OSSEC . HashSentry: Host-Based IDS in Python . Afick . 检测流程 1. OSSEC OSSEC is an Open So ...

  9. HDU4787 GRE Words Revenge(AC自动机 分块 合并)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=4787 Description Now Coach Pang is preparing for ...

随机推荐

  1. Python之字符串搜索和替换

    简单直接使用 str.replace() text="zzy is a beautiful boy" print(text.replace("boy",&quo ...

  2. SpringData 完全入门指南

    SpringData 笔记 1. 配置项目 1.pom.xml <?xml version="1.0" encoding="UTF-8"?> < ...

  3. sed以及awk

    一.sed sed是一种流编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时 缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的 内容,处理完成后,把缓 ...

  4. echarts 给formatter文字添加不同颜色

    legend: { x : 'center', y : 'bottom', icon: "circle", itemWidth: 8, // 设置宽度 itemHeight: 8, ...

  5. mysql-视图及索引简介

    一.视图的创建.作用及注意事项 1.创建:create view 视图名 as select 语句: 2.删除:drop view 视图名 3.作用: 数据库视图允许简化复杂查询 数据库视图有助于限制 ...

  6. Stm32CubeMX5 创建LED控制工程 - 基于stmf051k8u6

    一. 创建一个控制LED的工程 1. 安装好 Stm32CubeMX5 后 打开软件 选择 “ File-->  New Project...” 创建一个新工程 2. 之后会出现一个选择芯片的窗 ...

  7. Python操作MySQL实战案例讲解

    使用Python的pymysql库连接MySQL数据库 #导入pymysql import pymysql #连接MySQL数据库 #输入数据库的IP地址,用户名,密码,端口 db=pymysql.c ...

  8. MySQL练习题--sqlzoo刷题2

    SELECT from Nobel Tutorial 1.Change the query shown so that it displays Nobel prizes for 1950. SELEC ...

  9. Codeforces 1150D DP

    题意:给你一个长度为n的字符串,有q次询问,每次询问会给字符串x的末尾添加一个字符y,或者删除字符串x末尾的字符,询问过后,要判断长度为n的字符串中是否有3个不重合的子序列,是这3个字符串. 思路:设 ...

  10. day04 python列表 元组 range()

    day04 python   一.列表 1.什么是列表     列表是可变的数据类型: 和字符串不同, 做的操作直接改源数据     列表由[]来表示, 每项元素用逗号隔开.列表什么都能装,能装对象的 ...