作者jlovet (打不贏怪兵器不好)
看板Python
標題Re: [閒聊] pydoc glob 有幾個字看不懂
時間Tue Sep 8 16:14:40 2009
※ 引述《jlovet (打不贏怪兵器不好)》之銘言:
: $pydoc glob
: FUNCTIONS
: glob(pathname)
: Return a list of paths matching a pathname pattern.
: The pattern may contain simple shell-style wildcards a la fnmatch.
: iglob(pathname)
: Return a list of paths matching a pathname pattern.
: The pattern may contain simple shell-style wildcards a la fnmatch.
: 問題
: glob跟iglob有差嗎?
: a la fnmatch 是什麼意思?
不是 case insensitive喔...
iglob會回傳一個iterator
In [4]: a=iglob("*.h")
In [5]: print a
<generator object at 0x960644c>
In [6]: print a.next()
1.h
In [8]: print a
<generator object at 0x9eb44ac>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.102.254
推 linmic:win32 insensitive, linux sensitive, and iterator return 09/08 16:15
→ linmic:我樓上那篇有貼... 09/08 16:16
推 aquarianboy:喔!! 原來是這樣,果然手冊要讀 :) 09/08 17:22