03 2018 档案

摘要: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 我是外婆 阅读(834) 评论(0) 推荐(0)
摘要: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 我是外婆 阅读(400) 评论(0) 推荐(0)
摘要: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)
摘要: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 我是外婆 阅读(596) 评论(0) 推荐(0)
摘要:# _*_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 我是外婆 阅读(327) 评论(0) 推荐(0)
摘要:#装饰器小技巧一信号量控制 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 我是外婆 阅读(182) 评论(0) 推荐(0)
摘要:import xml.etree.ElementTree as tree import io xml = ''' 2 2008 141100 5 2011 59900 69 ... 阅读全文
posted @ 2018-03-08 10:04 我是外婆 阅读(1770) 评论(0) 推荐(0)
摘要:def parent(): t = son() print(type(t)) result = t.send(None) # 开始迭代 print(result) result = t.send(20) print(result) result = t.send(None) #引发StopIteration def son(): n... 阅读全文
posted @ 2018-03-06 09:53 我是外婆 阅读(268) 评论(0) 推荐(0)
摘要:from collections import deque #deque 双端队列 线程安全 可以代替list 更高效 d = deque('abc') #初始化一个队列 for v in d: print(v.upper()) d.append(['1', '2', '3']) #追加 print(d) d.appendleft('1')#左追加 d.extend('123')#... 阅读全文
posted @ 2018-03-03 18:24 我是外婆 阅读(134) 评论(0) 推荐(0)