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
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
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 =
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):
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
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
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