1、使用正则表达式进行URL匹配urlpatterns = patterns('', # ... (r'^time/plus/\d+/$', hours_ahead), # ...)(1)使用r代表字符串是原始字符串,表示python不会对立面的反斜杠\转义符进行处理,使用正则表达...
分类:
编程语言 时间:
2014-07-22 22:45:15
阅读次数:
235
uva 269 - Counting
Patterns
题目大意:给出n和k,要求找出满足的序列,要求为n元组,由-k到k组成,并且和为0。求出所有满足的元组个数,并且对于左移,右移,水平翻转,每个元素取相反数相同的视为一种,用字典序最大的表示,输出按照字典序最小的输出。
解题思路:因为表示的时候按照字典序最大的表示,一开始枚举开头的位置,那么在后面的数的绝对值就不会大于该数。最后...
分类:
其他好文 时间:
2014-07-22 00:16:37
阅读次数:
246
url中用法:urlpatterns = patterns(’’,url(r’^archive/(\d{4})/$’, archive, name="full-archive"),url(r’^archive-summary/(\d{4})/$’, archive, {’summary’: True...
分类:
其他好文 时间:
2014-07-21 14:31:30
阅读次数:
204
上一节最后讲到了建立一个extractor的方法,手工建立和机器学习等,这一节详细阐述手工建立pattern的方法。引用Jurafsky教授常说的话: let‘s look at the intuition. Jurafsky教授讲话总是微皱着眉头,感觉很较真...
分类:
其他好文 时间:
2014-07-21 13:30:48
阅读次数:
257
This post introduces how to implement the shallow and deep copy in JavaScript.
分类:
编程语言 时间:
2014-07-19 14:14:46
阅读次数:
194
Use an empty temporary constructor function F(). Set the prototype of F() to be the parent object. Return a new instance of the temporary construct...
分类:
编程语言 时间:
2014-07-19 08:36:01
阅读次数:
276
Description
Problem E
Eat or not to Eat?
Input: Standard Input
Output: Standard Output
A young farmer has N cows, but they produced really really a very very small amount of milk. John ca...
分类:
其他好文 时间:
2014-07-19 08:09:15
阅读次数:
296
Chain of Responsibility in the Real WorldThe idea of the Chain Of Responsibility is that it avoids coupling the sender of the request to the receiver,...
分类:
其他好文 时间:
2014-07-18 08:36:38
阅读次数:
294
There’s a convention on how to name a method, which is to be considered the constructor of the class. Classes inherit from other classes. There’s acce...
分类:
编程语言 时间:
2014-07-17 12:54:15
阅读次数:
255