作者tumc (HIHIHI)
看板Python
标题[问题] os.path.walk() 速度很慢?
时间Fri Sep 2 23:57:14 2011
小弟使用下面方式去访问data_path下的txt档但速度很慢,
同样的程式有使用过perl的File::Find去做速度很快,
感觉就是飞机与机车的速度差别,请问python有较快的module吗?
Python:
for root,dirs,files in os.walk(data_path):
......
Perl:
find(\&fileprocess, @book_path);
sub fileprocess { ....
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.133.5.111
※ 编辑: tumc 来自: 220.133.5.111 (09/03 00:17)
1F:→ AndCycle:你需要的是glob之类的 ... 09/04 02:02