os.walk: Get entire path

Tom B. sbabbitt at commspeed.net
Sun Aug 29 13:01:04 EDT 2004


"Florian Lindner" <Florian.Lindner at xgm.de> wrote in message
news:cgssom$hu6$00$1 at news.t-online.com...
> Hello,
> when I'm walking through a file system hierarchy using os.walk, how can I
> get the full path of a file or dir? normpath and abspath don't work.
> Thx,
> Florian

I would use glob

import glob

glob.glob('c:\\images\\*\\*.jpg')

yields all .jpg's in //images and sub directories with full path in a list.

Tom





More information about the Python-list mailing list