上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
摘要: 1 阅读全文
posted @ 2019-12-18 16:22 烧刘病 阅读(125) 评论(0) 推荐(0)
摘要: url对应的MyView.as_view()分析 ApiView .as_view() 返回一个csrf_exempt(view)即不经过csrf校验的view-->执行ApiView中的dispatch方法, -->重新封装了reqeust给其增加了一些新的属性--》执行self.initial, 阅读全文
posted @ 2019-12-18 13:53 烧刘病 阅读(146) 评论(0) 推荐(0)
摘要: from tornado.httpserver import HTTPServer from tornado.routing import RuleRouter, Rule, PathMatches, Router, HostMatches from tornado.web import Reque 阅读全文
posted @ 2019-11-30 21:03 烧刘病 阅读(581) 评论(0) 推荐(0)
摘要: 1 from tornado.httpserver import HTTPServer from tornado.httputil import HTTPServerConnectionDelegate, HTTPMessageDelegate, ResponseStartLine, HTTPHea 阅读全文
posted @ 2019-11-30 19:21 烧刘病 阅读(634) 评论(0) 推荐(0)
摘要: 本文借助动态转圈圈的例子展示 import sys import itertools import time import threading class Signal: go = True def spin(msg, signal): write, flush = sys.stdout.write 阅读全文
posted @ 2019-11-27 10:22 烧刘病 阅读(857) 评论(0) 推荐(0)
摘要: Cpython解释器本身就不是线程安全的,因此有全局解释器锁(GIL),一次只允许使用一个线程执行Python字节码。因此,一个python进程通常不能同时使用多个CPU核心。 Python标准库中的所有阻塞性I/O函数都会释放GIL,允许其他线程运行,time.sleep()都会释放GIL。因此, 阅读全文
posted @ 2019-11-22 09:52 烧刘病 阅读(162) 评论(0) 推荐(0)
摘要: else #else快的使用 for i in range(5): print(i) else: print('for end') ''' for while try(没有异常)完成最后执行else,注意没有break!!! ''' 阅读全文
posted @ 2019-11-21 11:06 烧刘病 阅读(197) 评论(0) 推荐(0)
摘要: 初识协程 ''' 协程中的datum=yield,其中的yild理解为控制流程的方式 ''' def simple_coroutine(): print('-->start coroutine') x = yield print('-->continue coroutine', x) my_coro 阅读全文
posted @ 2019-11-21 11:06 烧刘病 阅读(153) 评论(0) 推荐(0)
摘要: import re import reprlib RE_WORD = re.compile('\w+') ''' 生成器是迭代器 ''' def gen_123(): print('start') yield 'A' print('continue') yield 'B' print('end') 阅读全文
posted @ 2019-11-21 09:37 烧刘病 阅读(160) 评论(0) 推荐(0)
摘要: import re import reprlib RE_WORD = re.compile('\w+') class SentenceIterator: def __init__(self, words): self.words = words self.index = 0 def __next__ 阅读全文
posted @ 2019-11-21 09:22 烧刘病 阅读(85) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
回到页首