- 博客(8)
- 资源 (1)
- 收藏
- 关注
原创 html 转移的编码转换
html 转移的编码转换php的解决方案[code="php"][/code]python解决方案[code="python"]def unescape(text): """Removes HTML or XML character references and entities from a text string. @param text T...
2010-06-25 18:14:03 130
python UnicodeEncodeError: 'ascii' codec can't encode characters 解决方法
python UnicodeEncodeError: 'ascii' codec can't encode characters 详解 新建一个test.py[code="python"]#coding:utf-8s='nihao中国'.decode('utf-8')print type(s)print s[/code]执行错误:Traceback (mo...
2010-06-25 18:12:08 994
测试 内存映射文件 和文件随机 读写对比
[code="python"]def test_map(): ''' #make hello file dd if=/dev/zero of=hello.txt count=1024000 output:5242880000.557378053665 00.0396151542664 00.211034059525 00....
2010-06-10 22:07:48 211
原创 python 打乱一个数组的简单方法
:) [code="python"]#coding:utf-8import randomdef f(x,y):return random.randint(1,2)*2-3a=range(10)print a#[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]a.sort(f)print a#[3, 1, 8, 5, 2, 9, 0, 4, 6...
2010-05-28 15:33:02 368
mongodb 自增id 的解决方法
mongodb 自增id的解决方法mongodb id autoincrement mongodb 没有自增id的解决方法1.function insertObject(o) { x = db.myCollection; while( 1 ) { // determine next _id value to try ...
2010-04-28 16:41:49 565
python 2个html 解析器的比较 lxml.html 和 libxml2dom
lxml.html 和 libxml2dom 都很强大libxml2dom 和 lxml.html 都是基于 libxml的python包装,性能也都没有什么差别lxml.html 使用起来比较方便,但是api 不标准 libxml2dom 使用标准的api 用起来会比较舒服 和javascript的api一样[code="python"]#coding:utf-8...
2010-04-08 21:28:26 248
一个智力题的求解程序123456789这个9个数中间加2个减号1个加号等于100
原题是这样的123456789这个9个数中间加2个减号1个加号等于100想了觉得很难,很懒就写程序让计算机求解吧[code="python"]def run_main(): print 'hi' a='123456789' x=['--+','-+-','+--'] s=0 import time t1=time.time...
2010-03-27 22:33:00 1554
原创 分享一个简单的python模板引擎
python模板引擎也很多,但是希望可以使用python原生的来作模板 而不用在创建一个新的语法, 但是python本身的缩进又不适合做模板 所以要把缩进 去掉就可以了[code="java"]#coding:utf-8__author__="sdm"__author_email='sdmzhu3@gmail.com'__date__ ="$2009-8-2...
2010-03-12 22:55:06 167
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人