上一页 1 ··· 5 6 7 8 9
摘要: import requests res=requests.get('https://www.baidu.com/') res.raise_for_status() playFile = open('demo.txt','wb') for chunk in res.iter_counter(10000 阅读全文
posted @ 2018-09-29 17:15 keep2021 阅读(97) 评论(0) 推荐(0) 编辑
摘要: open()是python的内置函数,它会返回一个文件对象,这个文件对象拥有read、readline、write、close等方法。 语法:open('file','mode') 参数说明:file:需要打开的文件路径 mode(可选):打开文件的模式,如只读("r")、追加("a")、写入("w 阅读全文
posted @ 2018-09-28 14:58 keep2021 阅读(109) 评论(0) 推荐(0) 编辑
摘要: import os os.path.join('C:\\Users\\asweigart', filename) os.getcwd() # 获取当前目录 os.chdir(‘dirname’) # 改变当前目录 os.path.exits() # 文件或文件夹是否存在 os.path.isdir( 阅读全文
posted @ 2018-09-27 17:38 keep2021 阅读(148) 评论(0) 推荐(0) 编辑
摘要: form urllib import request jpg_link = '......' #图片链接 request.urlretrieve(jpg_link, path) # path为路径,如果不需要路径,也要有个名字,如 111.jpg就直接保存在当前目录下 阅读全文
posted @ 2018-09-12 16:56 keep2021 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 字符串str,二进制字符bytes。Python 3不会以任意隐式的方式混用str和bytes,你不能拼接字符串和字节流,也无法在字节流里搜索字符串。 内置函数bytes()可以将字符串str类型转换成bytes类型,如:b = bytes(s, encoding='utf-8') 内置函数str( 阅读全文
posted @ 2018-07-24 14:56 keep2021 阅读(822) 评论(0) 推荐(0) 编辑
摘要: 读 from openpyxl import load_workbook excel = load_workbook('E:/test.xlsx') # 打开文件 sheet = excel["Sheet1"] # 获取表名 rows=sheet.max_row # 获取行数 cols=sheet. 阅读全文
posted @ 2018-07-02 09:28 keep2021 阅读(175) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9