删除工程中svn文件的脚本(Ruby版和Python版)
两种不同的语言,不同的表达!
Python脚本实现.
""
"
File Name : clean.py
File Date : 2009/11/5 14:22:56
Author : DannyLai
Purpose : Clean the svn files
All svn projects have an hide directory "
.
svn"
The python script purpose is to clean the .svn directory in svn projects.
"
""
import
os
import
stat
SVNPROJECT_DIR =
"F:\\temp\\google-gdata"
def
findSVNDir(
path )
:
for
file in
os.
listdir(
path )
:
subpath =
os.
path.
join(
path,
file )
if
os.
path.
isdir(
subpath )
:
if
file =
=
".svn"
:
print
subpath
deleteSVNDir(
subpath )
else
:
findSVNDir(
subpath )
def
deleteSVNDir(
path )
:
for
file in
os.
listdir(
path )
:
subpath =
os.
path.
join(
path,
file )
if
os.
path.
isdir(
subpath
相关文档:
Python中文件操作可以通过open函数,这的确很像C语言中的fopen。通过open函数获取一个file object,然后调用read(),write()等方法对文件进行读写操作。
1.open
使用open打开文件后一定要记得调用文件对象的close()方法。比如可以用try/finally语句来确保最后能关闭文件。
file_object = open('thefile.txt' ......
转自 http://hi.baidu.com/xunxun129/blog/item/3befad0f8ff992c07bcbe180.html
有时我们需要在 Python 中使用 zip 文件,而在1.6版中,Python 就已经提供了 zipfile 模块可以进行这样的操作。不过 Python 中的 zipfile 模块不能处理多卷的情况,不过这种情况并不多见,因此在通常情况下已经足够使用了。下面我只是对 ......
http://code.google.com/p/android-scripting/
Android开始支持脚本语言Python、Lua及Beanshell,未来还将支持Ruby
作者 Werner Schuster 译者 张龙 发布于 2009年7月5日
Android Scripting Environment(ASE)项目为Android增加了脚本支持。通过安装ASE,我们可以在设备上编写脚本并执行。
虽然现在已经涌现出� ......
from cmd import *
class MyShell(Cmd):
def preloop(self):
print "print this line before entering the loop"
def postloop(self):
&nb ......
require 'win32ole'
fns = Dir.glob("*.xls")
application = WIN32OLE.new("excel.application")
application.visible = TRUE
f = File.new('errorCauseEN.xml','w')
f.puts('<?xml version="1.0" encoding="utf-8"?>')
f.puts('<!-- edited with XMLSPY v5 U (http://www.xmlspy.com) by et8 (et8) ......