易截截图软件、单文件、免安装、纯绿色、仅160KB

删除工程中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如何连接MySQL数据库

 
#!/usr/bin/env python
# -*-coding:UTF-8-*-#这一句告诉python用UTF-8编码
#=========================================================================
#
# NAME: Python MySQL test
#
# AUTHOR: benyur
# DATE  : 2004-12-28
#
# COMMENT: 这是一个python连接mysql的例子
#
#================ ......

Python 之禅

import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough t ......

Python读写文件


Python中文件操作可以通过open函数,这的确很像C语言中的fopen。通过open函数获取一个file object,然后调用read(),write()等方法对文件进行读写操作。
1.open
使用open打开文件后一定要记得调用文件对象的close()方法。比如可以用try/finally语句来确保最后能关闭文件。
file_object = open('thefile.txt' ......

被疏忽的一段Python语法

    python提供了有序(sequence)类型(字符串,元组,列表都是有序类型),并且提供了特殊的语法来方便对这些类型进行操作,最常用的有切片操作。同一有序类型的对象之间支持”+”操作符,用来连成一个新的有序对象,有序对象也可以与一个整数进行相乘,得到一个新的有序对象。在调试的时候,我经常使用这样 ......

RUBY EXCEL操作

 用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 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号