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")
相关文档:
由subprocess创建一个进程,然后进行监视
每一秒钟查看一次,如果正在运行,打印pid和running,如果已停止,,继续执行任务并打印Termined
shell和stdout均设置为False
也许这对做病毒的守护进程很好
#!/usr/bin/env python
import subprocess , sys , time
p=subprocess.Popen(['ping','127.0.0.1','-n','10'], she ......
Chapter 1
Python and XML
Python and XML are two very different animals, each with a rich
history. Python is a full-scale programming language that has grown
from scripting world roots in a very organic way, through the vision
and guidance of Python's inventor, Guido van Rossum. Guido continue ......
Python的字典操作
Python提供了多种应用于字典的操作。因为字典为容器,内建len函数可以将字典当作单一参数使用听切返回字典对象中项目(键/值对)的数目。
字典会员
在Python2.2以及后面版本,D中的k运算符检测是否对象k是字典D中的键。如果是返回True如果不是返回False。相似的,
索引一个字典
字典D中的值 ......
作者:taowen, billrice
http://www.cnblogs.com/taowen/articles/11239.html
Lesson 1 准备好学习Python的环境
下载的地址是:
www.python.org
为了大家的方便,我在校内作了copy:
http://10.1.204.2/tool/compiler&IDE/Python-2.3.2-1.exe
linux版本的我就不说了,因为如果你能够使用linux并安装好说明你可以 ......
最近要用到串口通讯,简单易用的Python又帮上忙了,多亏了庞大的第三方资源~~~ :)
pySerial
Overview
This module encapsulates the access for the serial port. It provides
backends for Python running on Windows, Linux, BSD (possibly any POSIX
compliant system), Jython and IronPython (.NET and M ......