摘要: Part 4: Forms and generic views====> Write a simple form$ edit polls\templates\polls\detail.html{{ question.question_text }}{% if error_message %}{{ e... 阅读全文
posted @ 2015-04-28 16:03 罗兵 阅读(342) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2015-04-28 12:20 罗兵 阅读(863) 评论(0) 推荐(0) 编辑
摘要: Part 3: Views and templates====> Write your first view$ edit polls\views.pyfrom django.http import HttpResponsedef index(request): return HttpResponse... 阅读全文
posted @ 2015-04-28 02:32 罗兵 阅读(578) 评论(0) 推荐(0) 编辑
摘要: Part 2: The admin site ====> Creating an admin user$ python manage.py createsuperuser Username: admin Email address: admin@example.com Password: *****... 阅读全文
posted @ 2015-04-27 15:53 罗兵 阅读(387) 评论(0) 推荐(0) 编辑
摘要: Django 特点强大的数据库功能 用python的类继承,几行代码就可以拥有一个丰富,动态的数据库操作接口(API),如果需要你也能执行SQL语句自带的强大的后台功能 几行简单的代码就让你的网站拥有一个强大的后台,轻松管理你的内容!优雅的网址 用正则匹配网址,传递到对应函数,随意定义,如你所想!模... 阅读全文
posted @ 2015-04-27 03:13 罗兵 阅读(594) 评论(0) 推荐(0) 编辑
摘要: 1、Process类from multiprocessing import Processdef func(name): print('hello', name)if __name__ == '__main__': p = Process(target=func, args=('bob'... 阅读全文
posted @ 2015-04-10 17:10 罗兵 阅读(654) 评论(0) 推荐(0) 编辑
摘要: 为了解决阻塞(如I/O)问题,我们需要对程序进行并发设计。本文将通过将线程和队列 结合在一起,轻松地在 Python 中完成线程编程,创建一些简单但有效的线程使用模式。一、使用线程先看一个线程不多的例子,不存在阻塞,很简单:import threadingimport datetimeclass M... 阅读全文
posted @ 2015-04-10 12:09 罗兵 阅读(585) 评论(0) 推荐(0) 编辑
摘要: import requestsimport refrom lxml import etree'''噢百万抓取'''url = 'http://www.obaiwan.com/hk49/results/'p = re.compile('''\r\n.+?\r\n(.+?)\r\n(.+?)\r\n(.... 阅读全文
posted @ 2015-04-08 15:03 罗兵 阅读(840) 评论(0) 推荐(0) 编辑
摘要: 本文是学习数据结构的笔记。【效果图】【代码】# example.py# 算法时间复杂度示例def func_01(n): ''' 时间复杂度O(Log(Log(N))) ''' import math i = n count = 0 while i > 1: ... 阅读全文
posted @ 2015-04-04 00:55 罗兵 阅读(722) 评论(0) 推荐(0) 编辑
摘要: 用matplotlib画雷达图,网上流传的版本其实都是官网的一个例子。但是那个例子太复杂,而且它封装了几个类,让人难以一眼看出其本质。我给出一个简单的解决方法,没有任何封装。作本文的原因,是为了回答百度网友的提问。 好吧,图很丑~~~。原问题见:http://zhidao.baidu.com/que... 阅读全文
posted @ 2015-03-24 01:37 罗兵 阅读(15938) 评论(6) 推荐(1) 编辑