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(.*?)
what have we learnt in day five的更多相关文章
- [note]What I’ve learnt from working on startups
What I've learnt from working on startups 从失败里学到了什么,六次创业失败. 企业家不是与生俱来的,也是靠学来的. 想的太多,做的太少.
- Today I learnt
2015-May-22 In Oracle database, dropping a table don't free up the space directly. You'll need to di ...
- 学习笔记之三十年软件开发之路 - 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 ...
- 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 ...
- 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. ...
- 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 ...
- Usual tiny skills & solutions
Ubuntu and Win10 - double OS 2016-02-21 Yesterday I helped my friend install Ubuntu (14.04 LTS) on h ...
- Sensitive directory/file Integrity Monitoring and Checking
catalogue . OSSEC . HashSentry: Host-Based IDS in Python . Afick . 检测流程 1. OSSEC OSSEC is an Open So ...
- HDU4787 GRE Words Revenge(AC自动机 分块 合并)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=4787 Description Now Coach Pang is preparing for ...
随机推荐
- Msys2编译Emacs
Msys2编译Emacs */--> code {color: #FF0000} pre.src {background-color: #002b36; color: #839496;} Msy ...
- 9-vim-移动命令-04-利用标记返回之前小编辑的代码位置
标记 在开发时,某一块代码可能需要处理,例如编辑或重看. 此时使用命令模式(普通模式)下使用m增加一个标记,这样可以在需要时快速地跳回来或者执行其他编辑操作. 标记名称可以是a~z或者A~Z之间的 ...
- redis 入门之列表
lpush 将一个或多个值 value 插入到列表 key 的表头如果有多个 value 值,那么各个 value 值按从左到右的顺序依次插入到表头: 比如说,对空列表 mylist 执行命令 LPU ...
- ReentrantReadWriteLock的相关使用
ReentrantLock具有完全互斥排他的效果,同一时间只有一个线程执行ReentrantLock.lock()方法后面的任务,这样虽然能够保证线程安全性,但是效率是比较低的 ReentrantRe ...
- Redis事务 和 pipleline
1.reidis事务 Redis 事务可以一次执行多个命令, 并且带有以下三个重要的保证: 批量操作在发送 EXEC 命令前被放入队列缓存. 收到 EXEC 命令后进入事务执行,事务中任意命令执行失败 ...
- 带你看懂LayoutInflater中inflate方法
关于inflate问题,我想很多人多多少少都了解一点,网上也有很多关于这方面介绍的文章,但是枯燥的理论或者翻译让很多小伙伴看完之后还是一脸懵逼,so,我今天想通过三个案例来让小伙伴彻底的搞清楚这个东东 ...
- linux的锁比较
spinlock spinlock介绍 spinlock又称自旋锁,线程通过busy-wait-loop的方式来获取锁,任时刻只有一个线程能够获得锁,其他线程忙等待直到获得锁.spinlock在多 ...
- element 的时间快捷键
1. <div> <el-date-picker v-model="value4" type="month" :picker-options= ...
- mongodb数据库管道操作
1.$project(修改文档的结构,可以用来重命名.增加或删除文档中的字段) db.order.aggregate([ { $project:{ rade_no:1, all_price:1} } ...
- swiper轮播箭头垂直居中
取消懒加载 for (var i in $('.p01-s9 .lazyload')) { $('.p01-s9 .lazyload').eq(i).attr('src',$('.p01-s9 .la ...