Lots of thanks for your help, My code can return the right result now. Thanks again!
On Sun, 23 Oct 2005 17:27:49 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >"Gonnasi" wrote: > >> With >> >glob.glob("*") >> >> or >> >os.listdir(cwd) >> >> I can get a combined file list with directory list, but I just wanna a >> bare file list, no directory list. How to get it? > >use os.path.isfile on the result. > > for file in glob.glob("*"): > if not os.path.isfile(file): > continue > ... deal with file ... > > for file in os.listdir(cwd): > file = os.path.join(cwd, file) > if not os.path.isfile(file): > continue > ... deal with file ... > > files = map(os.path.isfile, glob.glob("*")) > > files = (file for file in os.listdir(cwd) if > os.path.isfile(os.path.join(cwd, file))) > >etc. > ></F> > > -- http://mail.python.org/mailman/listinfo/python-list