基础语法
web
pip install beautifulsoup4
Scrapy框架
项目结构:
scrapy.cfg 配置文件
setting.py 定义爬虫的相关配置信息
items.py 定义待爬页面数据的结构
pipelines.py 定义存储爬到的数据的方式
middlewares.py 定义随机切换ip等逻辑
Spiders 在目录里,存放爬虫代码
scrapy startproject projectName 新建一个项目
1.在items模块中定义待爬取内容的数据结构
2.在spiders文件中
scrapy genspider name xxx.com 新建一个爬虫文件
3.pipelines中定义存储方式
4.settings中加入
ITEM_PIPELINES = {
"cnblogPrj.pipelines.CnblogprjPipeline": 300,
}
# 禁用cookies
COOKIES_ENABLED = False
x = float(input() )
y = float(input())
print("{:.3f} + {:.3f} = {:.3f}".format(x, y, x + y))
print("{:.3f} - {:.3f} = {:.3f}" .format (x, y, x - y))
print("{:.3f} * {:.3f} = {:.3f}" .format (x, y, x * y))
print("{:.3f} / {:.3f} = {:.3f}" .format (x, y, x / y))