删除工程中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
相关文档:
#!/usr/bin/env python
# -*-coding:UTF-8-*-#这一句告诉python用UTF-8编码
#=========================================================================
#
# NAME: Python MySQL test
#
# AUTHOR: benyur
# DATE : 2004-12-28
#
# COMMENT: 这是一个python连接mysql的例子
#
#================ ......
python提供了有序(sequence)类型(字符串,元组,列表都是有序类型),并且提供了特殊的语法来方便对这些类型进行操作,最常用的有切片操作。同一有序类型的对象之间支持”+”操作符,用来连成一个新的有序对象,有序对象也可以与一个整数进行相乘,得到一个新的有序对象。在调试的时候,我经常使用这样 ......
用ruby新建一个excel文件,并且设置一些值。
require 'win32ole'
excel = WIN32OLE.new("excel.application")
excel.Visible = true
excel.WorkBooks.Open("d:\\test.xls")
excel.WorkSheets("sheet1").Activate
excel.Cells(2,3).value = "张三"
exce ......
ipython 如果没有用装, 那就赶紧装上, 这个东西比起python自己带的那个交互界面要好用很多
shutil 类似于shell的一些接口, 比如 cp, mv等等
subprocess 调用子进程
optparse 解析命令行参数的, 用它来应付命令行参数, 简洁, 清晰
sqlite3 数据库, 进程级的数据库, 很酷, 甚至可以把这个数据库建在内存里. http://www.py ......
def delVss(path)
if File.directory?(path)
for f in d = Dir.open(path)
fpath = File.join(path, f)
if(f!="."&&f!="..")
......