上一页 1 ··· 59 60 61 62 63 64 65 66 67 ··· 81 下一页
摘要: locals()局部变量 globals()全局变量 vars() 阅读全文
posted @ 2020-04-27 10:22 Mars.wang 阅读(129) 评论(0) 推荐(0)
摘要: # 视图的基础函数——HttpResponse from django.http import HttpResponse def current_datetime(request): now = datetime.datetime.now() html = "<html><body>It is no 阅读全文
posted @ 2020-04-24 15:45 Mars.wang 阅读(121) 评论(0) 推荐(0)
摘要: 转自:https://blog.51cto.com/ljbaby/2348663 接口类 面向对象中的继承有两种用途:1)可以通过继承做到代码重用,并完成扩展;2)接口继承。所谓的接口继承就是定义一个接口类 Interface,接口类中定义了一些接口(就是函数,但这些函数都没有具体的实现),子类继承 阅读全文
posted @ 2020-04-24 12:01 Mars.wang 阅读(231) 评论(0) 推荐(0)
摘要: #zk监控 import json from datetime import datetime, timedelta from kazoo.client import KazooClient from kazoo.exceptions import NoNodeError def canal_mon 阅读全文
posted @ 2020-04-22 19:58 Mars.wang 阅读(1096) 评论(0) 推荐(0)
摘要: 之前一直困惑于python类在继承中冗长的参数,经过研究airflow的代码,发现是可以进行优化的. Father类有两个必选参数src,dst,和一个默认参数concurrency, 子类有两个必选参数target_db, target_tb,在子类的初始化方法__init__中只需要有targe 阅读全文
posted @ 2020-04-22 15:20 Mars.wang 阅读(3117) 评论(0) 推荐(0)
摘要: 转自:https://blog.csdn.net/yilulvxing/article/details/85374142 子类:Son类父类:Father类以下案例均表示Son类继承父类的一些属性和初始化参数构造等。 5个模块: (1):直接调用父类属性方法; (2):重写父类属性方法; (3):强 阅读全文
posted @ 2020-04-20 14:37 Mars.wang 阅读(243) 评论(0) 推荐(0)
摘要: 转自:https://github.com/chaseSpace/IPC-Inter-Process-Communication 六种进程间通信方式的Python3.6代码实现 msg_queue (消息队列) pipeline for single duplex (单工管道) pipeline f 阅读全文
posted @ 2020-04-09 19:53 Mars.wang 阅读(340) 评论(0) 推荐(1)
摘要: Python中进行并发编程一般使用threading和multiprocessing模块,不过大部分的并发编程任务都是派生一系列线程,从队列中收集资源,然后用队列收集结果。在这些任务中,往往需要生成线程池,concurrent.futures模块对threading和multiprocessing模 阅读全文
posted @ 2020-04-09 18:11 Mars.wang 阅读(614) 评论(0) 推荐(0)
摘要: 有些时候我们会遇到这样的需求,需要删除某个目录,但这个目录下有个别的文件或文件夹需要保留 下面这个脚本就是用来处理这类问题 # #针对大目录下保留部分子目录的程序化处理方案 # 1.从大目录列出下一级目录,匹配是否是需要保留的子目录的前缀,如果不是,保存到待删除dir_list # 2.如果是父目录 阅读全文
posted @ 2020-04-09 17:05 Mars.wang 阅读(1221) 评论(1) 推荐(0)
摘要: from multiprocessing.pool import Pool import boto3 import os client = boto3.client('s3') response = client.list_buckets() buckets = response['Buckets' 阅读全文
posted @ 2020-04-07 13:45 Mars.wang 阅读(704) 评论(1) 推荐(0)
上一页 1 ··· 59 60 61 62 63 64 65 66 67 ··· 81 下一页