fold all codes

随笔分类 -  python

摘要:文件读取写入,正则,没啥含量。#!e:/python32/python.exeimport osimport repat = r'(.*)\.chs\.srt'for f in os.listdir(): m = re.match(pat, f) if not m: continue ff = m.group(1) fop = open(ff + '.all.srt', 'w') linesChs = open(ff + '.chs.srt').readlines() linesEng = open(ff + '.eng. 阅读全文
posted @ 2012-03-09 21:25 hylent 阅读(561) 评论(0) 推荐(0)
摘要:由于现在还没有太多相关的中文文档,看手册理解的比较慢。主要是通过底层的<mysql.h>中的函数,简单封装成了一个模块(mysql)中的两个类(Connection、Result)以及若干方法。环境:window 7、mingw gcc 4.4.0、python 3.2、mysql 5.5。代码:mysql.c 1 #include <Python.h> 2 #include <windows.h> 3 #include <mysql.h> 4 5 /* Exceptions */ 6 static PyObject *ConnectionErr 阅读全文
posted @ 2011-12-24 17:48 hylent 阅读(509) 评论(0) 推荐(0)