超级网迷

超级网迷+ 电脑迷+ 音乐迷
个人资料
正文

Python 1-2-3: Write a string to file

(2011-03-03 19:45:33) 下一个

[Tip]:  Add the python install directory to the Path environment:
        i.e: set PATH=%PATH%;C:/Python27

[Script]:
       
# Write string (utf-8) to a file named "writestring.py"
# Date: Mar-3-2011

file = "n:/8/utorrent.exe"
f = open(file, 'r+')
words = 'this is my string'
f.seek(50)
f.write(words)
f.close()

# End of script
# Compiled and tested on vista Home x64


Programming is fun
When the work is done
if you wanna make your work also fun:
use Python!

[ 打印 ]
阅读 ()评论 (1)
评论
目前还没有任何评论
登录后才可评论.