04 2015 档案
摘要:Part 4: Forms and generic views====> Write a simple form$ edit polls\templates\polls\detail.html{{ question.question_text }}{% if error_message %}{{ e...
阅读全文
摘要:HomeMove cursor to the beginning of the line currently on.EndMove cursor to the end of the line currently on.Ctrl + UpScroll up one line.Ctrl + DownSc...
阅读全文
摘要:Part 3: Views and templates====> Write your first view$ edit polls\views.pyfrom django.http import HttpResponsedef index(request): return HttpResponse...
阅读全文
摘要:Part 2: The admin site ====> Creating an admin user$ python manage.py createsuperuser Username: admin Email address: admin@example.com Password: *****...
阅读全文
摘要:Django 特点强大的数据库功能 用python的类继承,几行代码就可以拥有一个丰富,动态的数据库操作接口(API),如果需要你也能执行SQL语句自带的强大的后台功能 几行简单的代码就让你的网站拥有一个强大的后台,轻松管理你的内容!优雅的网址 用正则匹配网址,传递到对应函数,随意定义,如你所想!模...
阅读全文
摘要:1、Process类from multiprocessing import Processdef func(name): print('hello', name)if __name__ == '__main__': p = Process(target=func, args=('bob'...
阅读全文
摘要:为了解决阻塞(如I/O)问题,我们需要对程序进行并发设计。本文将通过将线程和队列 结合在一起,轻松地在 Python 中完成线程编程,创建一些简单但有效的线程使用模式。一、使用线程先看一个线程不多的例子,不存在阻塞,很简单:import threadingimport datetimeclass M...
阅读全文
摘要:import requestsimport refrom lxml import etree'''噢百万抓取'''url = 'http://www.obaiwan.com/hk49/results/'p = re.compile('''\r\n.+?\r\n(.+?)\r\n(.+?)\r\n(....
阅读全文
摘要:本文是学习数据结构的笔记。【效果图】【代码】# example.py# 算法时间复杂度示例def func_01(n): ''' 时间复杂度O(Log(Log(N))) ''' import math i = n count = 0 while i > 1: ...
阅读全文