Python论坛  - 讨论区

标题:[python-chinese] 请教如何将一个目录下的所有目录名是svn的目录找出

2006年11月02日 星期四 16:54

麦田守望者 qcxhome在gmail.com
星期四 十一月 2 16:54:52 HKT 2006

import os.path

def walk_visit(arg, dirname, filenames):
    if dirname == arg:
        print dirname

def finddir(path, dirname):
    os.path.walk(path, walk_visit, dirname)

if __name__ == "__main__":
    # search the directory named "svn" from current directory
    finddir(".", "svn")

-- 
GoogleTalk: qcxhome at gmail.com
MSN: qcxhome at hotmail.com
My Space: tkdchen.spaces.live.com
BOINC: boinc.berkeley.edu
中国分布式计算总站: www.equn.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20061102/8fd383d9/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年11月03日 星期五 03:42

Samuel Lee samuel.d.lee在gmail.com
星期五 十一月 3 03:42:02 HKT 2006

按f3也搜索

在 06-11-2,麦田守望者<qcxhome at gmail.com> 写道:
>
>
> import os.path
>
> def walk_visit(arg, dirname, filenames):
>     if dirname == arg:
>         print dirname
>
> def finddir(path, dirname):
>     os.path.walk(path, walk_visit, dirname)
>
> if __name__ == "__main__":
>     # search the directory named "svn" from current directory
>     finddir(".", "svn")
>
> --
> GoogleTalk: qcxhome at gmail.com
> MSN: qcxhome at hotmail.com
> My Space: tkdchen.spaces.live.com
> BOINC: boinc.berkeley.edu
> 中国分布式计算总站: www.equn.com
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号