what have we learnt in day five
2024-10-07 19:13:10
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(.*?)
最新文章
- ElasticSearch 5学习(9)——映射和分析(string类型废弃)
- 第三个Sprint冲刺第八天
- CentOS RHEL 安装 Tomcat 7
- des加密解密的两个方法
- [git]git 分支
- Java-基础练习2
- [百科] - SIP(会话发起协议)
- 转:对TCP/IP网络协议的深入浅出归纳
- linux 命令(1)screen
- POJ 2153 Rank List (map映射)
- 由12306出错想到的div垂直居中的问题
- CF# 260 A. Laptops
- csdn肿么了,这两天写的博文都是待审核
- C#高级编程学习一-----------------第五章泛型
- [51nod1684]子集价值
- 我是如何沉迷于linux系统的?
- centos7 部署 docker ce
- 【PMP】组织级项目管理(OPM)和战略
- v-show v-if 的使用
- darknet中的若干问题