billiejoex <[EMAIL PROTECTED]> wrote:
>...
>glob.glob, instead, return file names only if given path is relative:
>
>>>> os.chdir('Desktop')
>>>> os.getcwd()
>'/home/user/Desktop
>>>> glob.glob("*")
>['file.py']
>
>...and absolute file names if given path is absolute:
>
>>>> glob.glob('/home/user/Desktop/*')
>['/home/user/Desktop/file.py']
>
>Don't you think it would be more convenient for glob.glob to return
>file names only in any case, like os.listdir do?

Martin gave you the real answer, but you should realize that your analysis
of the behavior is faulty.  In EACH case, glob.glob has returned all of the
names that exactly match your pattern.  It's not about absolute or
relative.  For example, if you do
    glob.glob( '..' )
which is a relative path, then the names you get back will be
['../xxx','../xxy','../xxz'].  They're not file names only.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to