python
文章平均质量分 58
YGR1123打SD
这个作者很懒,什么都没留下…
展开
-
12306 python登录并保存cookie
经过倒腾12306的登录,还是实现了,请求头很重要...各位感兴趣的可以继续写下去.....import sysimport timeimport requestsfrom PIL import Imageimport jsonimport osimport Headersimport SessionUtilimport UrlUtilsclass Ticket(obje...原创 2019-12-15 19:20:15 · 1224 阅读 · 2 评论 -
python 一些知识
一.面向对象class A(object): a=1 静态变量: 只能用类方法才能改变,子类可以访问 __b=2 私有属性 方法 只有在本类中调用 子类不能访问 不能被继承 def __init__(self): 类实例化时运行 pass def __call__(self): #A()()运行-->用类...原创 2019-08-24 20:57:44 · 96 阅读 · 0 评论 -
python 基本时间
import timeimport calendarprint(time.asctime(time.localtime()))print (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))#time.struct_time(tm_year=2019, tm_mon=9, tm_mday=1, tm_hour=9, tm_min...原创 2019-08-13 10:44:32 · 77 阅读 · 0 评论 -
python requests 模块
一.requests 模拟登录的三种方法 1.发送 post请求模拟登录 1.利用抓包获取 post登录 url, 以及登录时的form表单难度较大 2.将form表单中的数据封装成一个字典 ,data={ 'a': '1','b': '2'}的形式 3....原创 2019-08-20 14:07:40 · 302 阅读 · 0 评论 -
python 字符串
importjson 注意是双引号1.json.loads(a) 把字符串对象a转换为 python字典类型 json.load 针对一个类文件对象加载一个json文件并转换为python字典类型例如: with open('abc.json','r',encoding='utf-8' ) asf: ret=load(f...原创 2019-08-08 18:52:46 · 146 阅读 · 0 评论 -
urllib 模块
一.from urllib.parse import urlencode,parse_qs,parse_qsl,quote,unquote1.urlparse解析一个url网址中的参数result=urlparse( 'https://blog.csdn.net/c406495762/article/?b=456', scheme='http' )输出为 ParseRes...原创 2019-08-11 10:31:38 · 186 阅读 · 0 评论 -
python 图片简单处理 以及 识别简单的验证码
一.简单的识别from PIL import Imageimport pytesseract image = Image.open(path) 使用PIL库打开图片image = image.resize((110, 50)) 使用resize缩放图片尺寸code = pytesseract.image_to_stri...原创 2019-08-28 20:27:39 · 180 阅读 · 0 评论