摘要: # conding:utf8# *args 代表可以输入多个参数def test(*args): return args# *loc 解包,解元祖的包, list不能解包,list的值使用循环取值def main(loc): print(*loc)# **kwargs 代表输入多个键值对参数def 阅读全文
posted @ 2019-11-07 14:53 菜菜_包包 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 1、在base.py文件中写入 # conding:utf8import requestsimport jsonclass ApiDemo(object): def __init__(self): pass # 请求方式为get def api_get(self, url, params=None, 阅读全文
posted @ 2019-11-06 15:58 菜菜_包包 阅读(451) 评论(0) 推荐(0) 编辑
摘要: def read_yml(path): """ 读取yml文件中的数据 :param path: 文件yaml 的路径 :return: 返回读取yaml文件内的结果 """ try: file = os.path.isfile(path) #判断文件是否存在 if file: files = os 阅读全文
posted @ 2019-07-05 18:04 菜菜_包包 阅读(817) 评论(0) 推荐(0) 编辑
摘要: class Foo(): h = "hello world" def __init__(self, key, value): self.key = key self.value = value def foo_test(self): print("实例方法") print(self.h) print 阅读全文
posted @ 2019-06-05 11:47 菜菜_包包 阅读(261) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8 -*-# @Time : 2019/5/31 19:33# @Author : zejin# @File : pachong.pyfrom urllib import requestimport reclass Analysis(): url = 'https 阅读全文
posted @ 2019-06-01 14:48 菜菜_包包 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 1. test.yaml中的数据 这里的属性是list 2.创建用例 3,在yaml中创建数据,创建list数据,list中再创建dict数据,这样就可以读取dict中的多个参数的数据了 阅读全文
posted @ 2019-05-24 12:25 菜菜_包包 阅读(715) 评论(0) 推荐(0) 编辑
摘要: import loggingimport timeimport os,sys# from setting import *class Log: # 日志路径, 这里我写的自己配置的路径 log = ('report_' + ('%s') % time.strftime("%Y-%m-%d", tim 阅读全文
posted @ 2019-05-08 14:29 菜菜_包包 阅读(922) 评论(0) 推荐(0) 编辑
摘要: 如果在一个内部函数里,对在外部作用域(但不是在全局作用域)的变量进行引用,那么内部函数就被认为是闭包(closure) 1、def hello(): x=3 #x表示外部作用域,(外部变量) def world(): #内部函数块, 功能就是打印x print(x) #引用外部变量x, return 阅读全文
posted @ 2019-03-28 11:07 菜菜_包包 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 在需要导入的某个类的目录中,添加一个__init__.py的文件, 阅读全文
posted @ 2019-03-05 14:32 菜菜_包包 阅读(5416) 评论(0) 推荐(0) 编辑
摘要: import ConfigParserimport ospath = os.path.join(os.path.dirname(__file__), 'config.ini').replace('\\','/')print path# config = ConfigParser.ConfigPars 阅读全文
posted @ 2019-02-26 10:15 菜菜_包包 阅读(1861) 评论(0) 推荐(0) 编辑