摘要: 1、requests能上传文件 # 导入requests模块 import requests # 定义一个dict files = {'file': open('D:/360Downloads/1.txt', 'rb')} # post请求 response = requests.post("htt 阅读全文
posted @ 2020-03-18 17:10 Mr_choa 阅读(405) 评论(0) 推荐(0) 编辑
摘要: 1、安装pycharm community编辑器和python 3.7.2解释器的博客链接参考:https://blog.csdn.net/fangye945a/article/details/87829481 pycharm community只是一个编辑器,没有python解释器是运行不了pyt 阅读全文
posted @ 2020-03-18 11:38 Mr_choa 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1、例如打开要爬取的网页:https://www.zhihu.com/explore 2、按下F12,点击Network 3、刷新页面,点击explore 4、选取request headers,user-agent的内容 更加详细的http header详解参考博客:https://www.cnb 阅读全文
posted @ 2020-03-16 18:54 Mr_choa 阅读(5072) 评论(0) 推荐(0) 编辑
摘要: 1、先安装requests库,打开cmd,输入:pip install requests 2、弄明白几个请求函数的关系: (1)、GET: 请求指定的页面信息,并返回实体主体。(2)、HEAD: 只请求页面的首部。(3)、POST: 请求服务器接受所指定的文档作为对所标识的URI的新的从属实体。(4 阅读全文
posted @ 2020-03-16 15:37 Mr_choa 阅读(449) 评论(0) 推荐(0) 编辑
摘要: 1、map()传入的有两个参数,函数和可迭代对象(Itreable),map()是把传入的函数依次作用于序列的每个元素,结果返回的是一个新的可迭代对象(Iterable)。 map()代码如下: # 定义f函数,返回的是x*x def f(x): return x*x # 调用map(),根据传入的 阅读全文
posted @ 2020-03-15 22:08 Mr_choa 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 迭代器(Iterable):能直接作用于for循环的对象,统称可迭代对象。例如:list、tuple、set、str、generator都是可迭代对象。 1、如何判断一个对象是否可迭代: # 如何判断一个对象是可迭代对象 #导入collections.abc模块中的Iterable对象 import 阅读全文
posted @ 2020-03-15 21:33 Mr_choa 阅读(186) 评论(0) 推荐(0) 编辑
摘要: MySQL Notifiter是MySQL 数据库的辅助工具。 1、打开MySQL Notifiter Command Line Client,输入密码:123456(这是我自己的) 2、创建一个名为day01的数据库 create database day01; 3、使用day01数据库 use 阅读全文
posted @ 2020-03-15 20:45 Mr_choa 阅读(624) 评论(0) 推荐(0) 编辑
摘要: 代码实现: # python实现杨辉三角形 def yanghui(): # 定义第一行列表为[1] line = [1] while True: # yield的作用:把一个函数变成生成器,同时返回一个list,下次从yield的下条语句执行 yield line # 设上一个为[1],通过式子可 阅读全文
posted @ 2020-03-14 23:23 Mr_choa 阅读(2256) 评论(0) 推荐(1) 编辑