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 比赛(这个比赛关注 ......
Python-String-Function
字符串中字符大小写的变换:
* S.lower() #小写
* S.upper() #大写
* S.swapcase() #大小写互换
* S.capitalize() #首字母大写
&n ......
中文简介
Python (发音:[ 'paiθ(?)n; (US) 'paiθ?n ]n.蟒蛇,巨蛇 ),是一种面向对象的解释性的计算机程序设计语言,也是一种功能强大而完善的通用型语言,已经具有十多年的发展历史,成熟且稳定。Python 具有脚本语言中最丰富和强大的类库,足以支持绝大多数日常应用。它的名字来源于一个喜剧,也许最初设 ......