Source

wd_pys60 / wd_file_cn.py

# -*- coding: utf-8 -*-
import sys
sys.setdefaultencoding("utf8")
def cn(x):
    return x.decode("utf8")
def en(x):
    return x.encode("utf8")
filePathName=unicode(en("e:\\cn\\和.txt"),"utf8")
f=file(filePathName,"w+")
f.write("和ss")
f.close()
f=file(filePathName,"r")
print f.read()
f.close()
import e32dbm
DB_FILE="e:\\jin_xiao"
DB = e32dbm.open(DB_FILE, 'c')
DB["是"]="5"
print DB["是"]