会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
我是外婆
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
9
下一页
2018年5月2日
python class(1)
摘要: class Test: _parent1 = 'variable parent' #父类成员变量首先被初始化 print(_parent1) _son_son = 'search parent' def __init__(self): print(self) #实际对应的实例化对象这里为 Test2 的实例 print('pare...
阅读全文
posted @ 2018-05-02 10:40 我是外婆
阅读(146)
评论(0)
推荐(0)
2018年4月27日
python 装饰器小技巧(2) 给类添加日志输出
摘要: import logging #创建日志文件 file = './test123.log' logger = logging.getLogger('test') #设置日志等级 logger.setLevel(logging.INFO) #添加文件输出流 filehanle = logging.FileHandler(file, mode='a') #设置日志输出格式 formatter ...
阅读全文
posted @ 2018-04-27 11:21 我是外婆
阅读(1342)
评论(0)
推荐(0)
2018年4月20日
pyqt 控件随窗口改变而改变
摘要: # _*_coding:utf-8_*_ # author:leo # date: # email:alplf123@163.com from PyQt5.QtWidgets import QApplication, QMainWindow, QTextEdit, QWidget, QVBoxLayout, QFrame from PyQt5.Qt import QSize import sy...
阅读全文
posted @ 2018-04-20 23:24 我是外婆
阅读(5592)
评论(0)
推荐(0)
2018年4月9日
python optparser 参数解析
摘要: from optparse import OptionParser parser = OptionParser() parser.add_option('-f', '--file', dest='filename', help='test') # action 指定目的dest 存储的默认值 有时候参数不是必须的就可以设置action类型的默认值例如 true, false等 #常用的有 st...
阅读全文
posted @ 2018-04-09 20:51 我是外婆
阅读(808)
评论(0)
推荐(0)
2018年3月29日
pyqt 那些‘坑’(二)
摘要: from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.Qt import * import sys class CustomToolBar(QToolBar): def __init__(self, parent=None): super(CustomToolBar, self).__...
阅读全文
posted @ 2018-03-29 14:40 我是外婆
阅读(831)
评论(0)
推荐(0)
2018年3月27日
pyqt 那些‘坑’(一)
摘要: class Example(QMainWindow): def __init__(self, parent=None): super(Example, self).__init__(parent=parent) self._initUI() def _initUI(self): self.toolBar = QToolBar()...
阅读全文
posted @ 2018-03-27 09:10 我是外婆
阅读(397)
评论(0)
推荐(0)
2018年3月17日
python raise 引起的异常
摘要: def handle(func): def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Exception as e: print('sfdsd') return wrapper @handle #捕获异常,后面...
阅读全文
posted @ 2018-03-17 16:36 我是外婆
阅读(733)
评论(0)
推荐(0)
2018年3月12日
python asyncio 并发 队列(一)
摘要: import asyncio, threading import aiohttp class Tasks(): def __init__(self, max_async, loop=None): self.loop = loop or asyncio.get_event_loop() self._queue = asyncio.Queue(maxs...
阅读全文
posted @ 2018-03-12 14:24 我是外婆
阅读(594)
评论(0)
推荐(0)
2018年3月10日
python 线程条件变量锁
摘要: # _*_coding:utf-8_*_ # author:leo # date: # email:alplf123@163.com import queue, threading class Worker(threading.Thread): def __init__(self): threading.Thread.__init__(self) s...
阅读全文
posted @ 2018-03-10 21:42 我是外婆
阅读(324)
评论(0)
推荐(0)
2018年3月9日
python 装饰器小技巧(一) 信号量控制
摘要: #装饰器小技巧一信号量控制 import threading, time NUM = 10 # 定义信号量控制 def synchronized(func): func.__sem__ = threading.Semaphore(value=NUM) print(func.__sem__) def wraper(*args, **kwargs): #支持...
阅读全文
posted @ 2018-03-09 10:45 我是外婆
阅读(181)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
9
下一页
公告