05 2020 档案
摘要:grep '19/May/2020' error.log,在error.log文件中查找含有“19/May/2020”字段的行; grep -c '19/May/2020' error.log,在error.log文件中查找含有“19/May/2020”字段的行数; grep '19/May/202
阅读全文
摘要:import xlrd, xlwt, re def read_file(): #读取数据 book = xlrd.open_workbook('file_org.xlsx') sheet = book.sheet_by_index(0) #打开第一个页面,一个Excel里面可能有多个页面,在左下角那
阅读全文
摘要:当流下载时,用Response.iter_content或许更方便些。requests.get(url)默认是下载在内存中的,下载完成才存到硬盘上,可以用Response.iter_content来边下载边存硬盘 作者:朝畫夕拾链接:https://www.jianshu.com/p/6848eba
阅读全文
摘要:这里记录一下遇到的坑: 报错:raise MissingSchema(error) 原请求:https%3a%2f%2fapi.m.jd.com%2fclient.action%3ffunctionId%3dvvipclub_coupon_dispatch%26body%3d%7b%22ruleId
阅读全文
摘要:匹配多个条件:re.findall(r'sellerId=\d{5,20}|tpId\":\"\d{5,20}|tp_id=\d{5,20}', response) 匹配单个条件:re.findall(r'shop_id\":\"(\d*)', response) 这里需要注意两点:1、匹配单个条件
阅读全文
摘要:打印文件路径: import os print(__file__)#获取当前程序路径,注意:这里打印出来的路径为相对路径 #动态获取绝对路径 print(os.path.abspath(__file__)) #这才是当前程序绝对路径 print(os.path.dirname(os.path.abs
阅读全文
摘要:1、查看已创建会话:tmux ls; 2、进入已创建会话:tmux a -t name(已有会话名字); 3、脱离当前会话;这样可以暂时返回Shell界面,输入tmux attach能够重新进入之前的会话:快捷键:先按ctrl+b, 放开后再按 d;或者tmux detach 4、关闭当前会话(相当
阅读全文