[Tutor] listdir, ispath and unicode (followup question)

alan.gauld@bt.com alan.gauld@bt.com
Fri, 2 Aug 2002 15:02:44 +0100


>  >>> filename = os.path.join(os.getcwd(), os.listdir(os.getcwd())[0])
>  >>> filename
> 'd:\\tmp2\\???????'
>  >>> os.path.isfile(filename)
> 0

> The file, 'd:\\tmp2\\???????', is a text file which I created for 
> testing this problem.  

Hmm, I'm surprised you could create that.
The '?' character is a wildcard character in DOS so
that you can, for example, specify:

foo??.doc

In explorer and get a list of all the .doc files starting 
with foo then 2 characters. eg foo01.doc, foo02.doc etc

So a file ??????? will match any file that has exactly 
7 characters in its name and no extension.

What happens when you create a file called "???????" I 
have no idea! Its probably a bad policy IMHO

Alan G.