2018年6月23日

python 字符串格式化

摘要: 1,基本用法 1,正常拼串 s1 = '%s aaa %s'('alice','bob') 2.format 不带编号 s1 = '{} aaa {}' s1.format('hello','world') 带编号 s1 = '{1} aaaa {2} bbb {1}' s.format('hell 阅读全文

posted @ 2018-06-23 11:13 么么唧唧 阅读(163) 评论(0) 推荐(0) 编辑

django转发和重定向

摘要: 1 转发 HttpResponse、render 2重定向 HttpResponseRedirect、redirect 区别:转发不会改变url,改变内容 重定向会跳转另一个html redirect('manage:index') HttpResponseRedirect(reverse('man 阅读全文

posted @ 2018-06-23 11:00 么么唧唧 阅读(1445) 评论(0) 推荐(0) 编辑

python 进程间通信Queue

摘要: Queue的使用 Queue.qsize() #返回当前队列包含的消息数量 Queue.empty() #如果队列为空,返回True,反之False Queue.full() #如果队列满了,返回True,反之False Queue.get([block[, timeout]]) #获取队列中的一条 阅读全文

posted @ 2018-06-23 10:25 么么唧唧 阅读(229) 评论(0) 推荐(0) 编辑

requests 状态码

摘要: # 信息性状态码 100: ('continue',), 101: ('switching_protocols',), 102: ('processing',), 103: ('checkpoint',), 122: ('uri_too_long', 'request_uri_too_long'), 阅读全文

posted @ 2018-06-23 09:54 么么唧唧 阅读(2059) 评论(0) 推荐(0) 编辑

beautifulsoup 解析库

摘要: 1.常用解析器 2.基本用法 节点选择器 soup = BeautifulSoup(html,'lxml')print(soup.a)#选择a节点 <a class="sister" href="http://example.com/elsie" id="link1"><!-- Elsie -->< 阅读全文

posted @ 2018-06-23 09:48 么么唧唧 阅读(253) 评论(0) 推荐(0) 编辑

python测试程序耗时

摘要: 1.使用time库 例如:import time start_time = time.time() ... elapse_time = time.time() - start_time 2.ipython 使用time、timeit 例如:%time%run xxx.py %timeit%run x 阅读全文

posted @ 2018-06-23 08:46 么么唧唧 阅读(3555) 评论(0) 推荐(0) 编辑

导航