python递归列出目录及其子目录下所有文件 一.前言 函数的递归,简单来说,就是函数内部调用自己 先举个小例子,求阶乘 def factorial(n): if n == 0: return 1 else: return n * factorial(n-1) 递归要注意两个事项: 1.必须要有最后的默认结果,也就是最底层目录的默认结果 if n == 0 2.递归参数必须向默认结果收敛 factorial(n-1) 要用到 os 模块下的几个方法 要用到 os 模块下的几个方法 二.递归列出目
HOWTO Use Python in the web - Python v3.0.1 documentation mod_python¶ People coming from PHP often find it hard to grasp how to use Python in the web. Their first thought is mostly mod_python because they think that this is the equivalent to mod_php.