摘要: import urllibimport urlparsedef url_add_params(url, **params): """ 在网址中加入新参数 """ pr = urlparse.urlparse(url) query = dict(urlparse.parse_... 阅读全文
posted @ 2011-07-04 14:28 阿债 阅读(1615) 评论(0) 推荐(0)
摘要: 添加一个用户dba,密码sql,可以管理db_开头的数据库GRANT ALL PRIVILEGES ON `db\_`.* TO 'dba'@'localhost' IDENTIFIED BY 'sql' WITH GRANT OPTION;FLUSH PRIVILEGES; 从其他机器访问... 阅读全文
posted @ 2011-03-02 11:46 阿债 阅读(84) 评论(0) 推荐(0)
摘要: 昨天装好了Couchdb-1.0.2,用couchdb -b启动正常,用curl http://127.0.0.1:5984/也能收到欢迎信息,却打不开网页客户端Futon。想起之前也碰到这样的问题,第二天自己好了,就把Linux重启了一下,解决了!应该是某个依赖的进程需要重启,猜测是js ... 阅读全文
posted @ 2011-02-16 10:43 阿债 阅读(247) 评论(0) 推荐(0)
摘要: 转自 http://my.oschina.net/captaintheron/blog/8898下面,本文就将结合具体的例子来说明怎样利用curl进行下载。 1、获得一张页面 使用命令:curl http://curl.haxx.se 这是最简单的使用方法。用这个命令获得了http:/... 阅读全文
posted @ 2011-01-19 14:27 阿债 阅读(172) 评论(0) 推荐(0)
摘要: #! /usr/bin/python# -*- coding: utf-8 -*-def check_id_num(id_num): assert len(id_num) == 18 and id_num[:17].isdigit() factors = [7, 9, 10, 5... 阅读全文
posted @ 2011-01-15 17:57 阿债 阅读(178) 评论(0) 推荐(0)
摘要: #! /usr/bin/python# -*- coding: utf-8 -*-def get_constellation(ymd="2000-01-01"): stellates = [ {'date':120, 'name':u'水瓶座'}, {'da... 阅读全文
posted @ 2011-01-15 17:55 阿债 阅读(151) 评论(0) 推荐(0)
摘要: 设置python运行环境的编码参考这里 http://diveintopython.org/xml_processing/unicode.html《Dive Into Python》 的 Example 9.15. sitecustomize.py# sitecustomize.py #... 阅读全文
posted @ 2011-01-15 17:54 阿债 阅读(147) 评论(0) 推荐(0)
摘要: 不是代码出的问题,是*.pyc文件被改动了。解决方法,删除所有*.pyc文件再运行 阅读全文
posted @ 2011-01-11 14:53 阿债 阅读(2186) 评论(0) 推荐(0)
摘要: 以下脚本在CentOS 5 上通过 #!/bin/bash# 切换到root开始安装su -mkdir /data/Downloads/chmod -R 777 /data/Downloads/cd /data/Downloads/wget http://postfix.it-austria... 阅读全文
posted @ 2010-12-16 19:03 阿债 阅读(208) 评论(0) 推荐(0)
摘要: Python关于时间日期有两个库datetime和time,于是我们要在四种格式之间转换:datetime.datetime对象 datetime.datetime.now()time.struct_time对象 time.localtime()字符串 "2010-12-04T10:30:... 阅读全文
posted @ 2010-12-06 18:37 阿债 阅读(348) 评论(0) 推荐(0)