python中文目录
如有一路径"e:/software/测试.txt"
需要通过pyhon读/写 "测试.txt"文件,可以采用下面的方法:
ipath = "e:/software/测试.txt"
uipath = unicode(ipath , "utf8")
然后用"uipath"经过编码后的路径去open()即可。
下面是我在项目中用python读写excel的一点体会(解决了读中文文件名问题,其实中文目录路径也一样):
def transExcel( inPath ) :
excelApp = Dispatch("Excel.Application")
inWorkbooks = excelApp.Workbooks.Open( unicode( inPath, "utf8" ) )
#测试下inWorkbooks这个东东有地址么?
print "transExcel...",inWorkbooks
transExcel("e:/software/测试.xls")
相关文档:
Documentation for C's fopen():
---
r Open text file for reading. The stream is positioned at the beginning
of the file.
r+ Open for reading and writing. The stream is positioned at the
beginning of the file.
w Truncate file to zero length or create text file for writing. The
stream is posi ......
Alex. J. Champandard
赖勇浩(http://laiyonghao.com) 译
原文地址:http://aigamedev.com/open/interviews/inside-galcon-python-ai/
AiGameDev.com在这个周一的 pratical insights 是对Phil Hassey采访。Phil 是一个独立游戏开发者,也是游戏产业社区的活跃分子。他曾赢得2006年4月的 Ludum Dare 比赛(这个比赛关注 ......
一般安装的都是Python22版,wincvs1.3需要python2.1版本及以上。但是启动过程找不到,网上搜索的方法不大适用。最后经过试验发现,把Python22安装路径下的python22.dll拷贝到wincvs的安装目录下。运行wincvs,ok。觉得这个方法好用的给顶下! ......
下面这个小工具包含了 判断unicode是否是汉字,数字,英文,或者其他字符。 全角符号转半角符号。 unicode字符串归一化等工作。 还有一个能处理多音字的汉字转拼音的程序,还在整理中。
#!/usr/bin/env python
# -*- coding:GBK -*-
"""汉字处理的工具:
判断unicode是否是汉字,数字,英 ......