摘要:
打印结果: One (in Thread-A) Two (in Thread-B) Main-Thread threading.local()这个方法的特点用来保存一个全局变量,但是这个全局变量只有在当前线程才能访问, localVal.val = name这条语句可以储存一个变量到当前线程,如果在 阅读全文
摘要:
#-*-coding:utf-8-*- from flask import Flask from flask import request import time from xml.etree import ElementTree as ET app=Flask(__name__) @app.route('/wechat',methods=['GET','POST']) def index():... 阅读全文
摘要:
class Singleton(object): def __new__(cls,*args,**kwargs): if not hasattr(cls,'_instance'): orig=super(Singleton,cls) cls._instance=orig.__new__(cls) return... 阅读全文
摘要:
Python的字符串格式化有两种方式: 百分号方式、format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存。[PEP-3101] This PEP proposes a new system for built-in string for 阅读全文