上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 65 下一页
摘要: 背景 非单例 class A: pass a1=A() a2=A() print(id(a1)) print(id(a2)) ''' 1618986824272 1618986826096a1和a2的id不一样 ''' 单例 class Single: _self = None def __new_ 阅读全文
posted @ 2023-08-31 21:24 胖豆芽 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 转载来源 https://www.lmlphp.com/user/107993/article/item/2699346/ 使用Moco模拟接口以下功能: 拦截服务:http,https。 请求方式:GET,POST。 模拟请求地址:URL。 模拟参数:包括header和cookie的数据。 模拟响 阅读全文
posted @ 2023-08-30 15:06 胖豆芽 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 无法连接仓库:Command "git ls-remote -h -- https://gitee.com/xxx/xxxrned status code 128: stdout: stderr: remote: [session-554c92af] Username for 'https 阅读全文
posted @ 2023-08-23 15:01 胖豆芽 阅读(1091) 评论(0) 推荐(0) 编辑
摘要: import os # 1 获取当前文件的绝对路径目录 Dir=os.path.abspath(__file__) print(f"1 绝对路径:{Dir}") # 2 去掉文件名称 保留获取目录 DirNo=os.path.dirname(Dir) print(f'2 去掉名称保留路径:{DirN 阅读全文
posted @ 2023-08-22 15:59 胖豆芽 阅读(14) 评论(0) 推荐(0) 编辑
摘要: import json class MyClass(): # 类变量 can1 = "dog" can2 = "wang" # 方法2 def is_json(self, data): try: return json.load(data) except: return data # 方法1 def 阅读全文
posted @ 2023-08-22 12:36 胖豆芽 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 一个参数传递时结果:(参数1) 两个参数传递时: 参数1 参数2 对(a,)暴力解决办法: 下标取值a[0] >a 阅读全文
posted @ 2023-08-22 10:44 胖豆芽 阅读(14) 评论(0) 推荐(0) 编辑
摘要: #\libs\request_test.pyfrom libs.login_my import Login from libs.food_my import Food # 调用登录获得token l=Login() t=l.login(is_need_token=True) # 将登录获得的toke 阅读全文
posted @ 2023-08-21 12:42 胖豆芽 阅读(8) 评论(0) 推荐(0) 编辑
摘要: import inspect def fun1(): fun2() def fun2(): who=inspect.stack()[1][3] # 记录被谁调用了 print(f"{who}") print(type(who)) fun1() ''' 'fun1' <class 'list'> '' 阅读全文
posted @ 2023-08-18 16:29 胖豆芽 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 一般的文件 读取的包含换行符 是数组格式 # open def get_yaml(file_path): with open(file_path,encoding='utf-8') as fo: print(fo.readlines()) if __name__ == '__main__': get 阅读全文
posted @ 2023-08-16 15:53 胖豆芽 阅读(20) 评论(0) 推荐(0) 编辑
摘要: # *args **kwargs的用法 def get_data(name,age,*args,**kwargs): print(f"name:{name},age:{age},可变参数:{args},可变键值对参数:{kwargs}") if __name__ == '__main__': get 阅读全文
posted @ 2023-08-16 15:30 胖豆芽 阅读(2) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 65 下一页