- 博客(6)
- 资源 (5)
- 收藏
- 关注
原创 python challenge第4题
import urllib2, re charnum_dic = {'one':1, 'two':2} nothing=12345 #nothing=16044 #nothing=82682 #nothing=87890 for x in xrange(400): f = urllib2.urlopen('http://www.pythonchallenge.com/pc/def/li
2012-02-08 00:26:09 1087
原创 python challenge第3题
这道题目是 One small letter, surrounded by EXACTLY three big bodyguards on each of its sides. 直觉就是用正则来做 一开始使用得正则是 reg = re.compile('[A-Z]{3}([a-z])[A-Z]{3}')发现匹配出来得东西特别多, 又研究题目,觉得EXACTLY是不是指包括得字符得是一样得比如
2012-02-07 23:38:00 2999
原创 python源码查找子串
首先找到string.find定义的地方, 在Objects/stringobject.c: static PyObject * string_find(PyStringObject *self, PyObject *args) { Py_ssize_t result = string_find_internal(self, args, +1); if (result ==
2012-02-07 13:28:35 2260 3
转载 python string hash 函数
static long string_hash(PyStringObject *a) { register Py_ssize_t len; register unsigned char *p; register long x; if (a->ob_shash != -1) return a->ob_shash; len = Py_SIZE(
2012-02-03 15:09:19 11310 1
原创 打印出字母构成一样的词
primes = [2, 3, 5, 7, 11 ,13 ,17 ,19 ,23 ,29 ,31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101] sample = ['hat', 'top', 'pot', 'peer', 'pper', 'pire', 'ripe'] def printSameChar(word_
2012-02-03 12:39:51 819
原创 自然数序列,找出任意连续之和等于n的所有子序列
lst = [0,2,4,5,3,1,8,6,4,7,9,3,2] total_sum = 9 def sum_seq(lst): seq = [] ct = 0 for x in lst: seq.append(x) ct += x if ct == total_sum: print seq
2012-02-02 10:24:09 3700
download程序C#源码,支持断点续传
2008-09-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人