Re: How to separate directory list and file list?

2005-10-24 Thread Gonnasi
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

How to separate directory list and file list?

2005-10-23 Thread Gonnasi
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? Tons of thanks in advance! Gonnasi -- http://mail.python.org/mailman/listinfo/python-list

Re: How to separate directory list and file list?

2005-10-23 Thread Oliver Andrich
Hi, 2005/10/23, Gonnasi [EMAIL PROTECTED]: 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? don't know if it is the best solution, but it looks nice. :) path = /home/test files =

Re: How to separate directory list and file list?

2005-10-23 Thread Fredrik Lundh
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):

Re: How to separate directory list and file list?

2005-10-23 Thread Peter Hansen
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? Using Jason Orendorff's path module, it's just this: from path import path path('.').files() # returns list of

Re: How to separate directory list and file list?

2005-10-23 Thread George Sakkis
Gonnasi [EMAIL PROTECTED] 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? Tons of thanks in advance! Gonnasi Using the path module

Re: How to separate directory list and file list?

2005-10-23 Thread Alex Martelli
Gonnasi [EMAIL PROTECTED] 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? I see everybody's suggesting os.path.* solutions, and they're fine, but an interesting