python
huiyifan_python
这个作者很懒,什么都没留下…
展开
-
python中logging模块学习使用
# -*- coding:utf-8 -*- import logging # 创建日志器对象 logger = logging.getLogger(__name__) # 设置处理器 con_hanger = logging.StreamHandler() # 设置logger可输出日志级别范围 con_hanger.setLevel(logging.DEBUG) # 设置处理器的格式 formatter = logging.Formatter('%(asctime)s - %(name)s.转载 2021-04-14 16:45:18 · 81 阅读 · 0 评论 -
pytest之fixture问题求解
使用pytest测试框架,在conftest添加打开网页链接后在测试用例中如何继续用ele_obj # -*- coding:utf-8 -*- import pytest,os,sys print(sys.path) from selenium import webdriver from Auto_UI.common import read_config url = read_config.Get_config().read_config() @pytest.fixture() def ope原创 2021-01-13 19:08:54 · 288 阅读 · 3 评论 -
response.text 和 response.content 的区别
#!/usr/bin/evn python # -*- coding:utf-8 -*- import requests response = requests.get('https://www.baidu.com') print(response) print(response.text) #打印的是乱码(解码方式和编码方式不一致) print(response.encoding) #查看响应内容的编码方式 response.encoding = 'utf-8' #指定解码方式 print(r...原创 2020-07-15 01:50:41 · 1018 阅读 · 0 评论 -
dump 与 load dumps与loads
#!/usr/bin/env python # -*- coding: utf-8 -*- #@Time : 2020/7/4 21:56 #@Author : HDD #@Site : #@File : remember_me.py #@Software: PyCharm import json def get_stored_username(): filename = 'username.json' try: with open(...转载 2020-07-04 22:13:44 · 189 阅读 · 0 评论