[Tutor] getopts question

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Sat Mar 31 10:19:42 CEST 2007


Greg Perry schreef:
> Yeah I figured that.  I am trying to find a way to have the program
> detect if the user input is a file or directory, which is easy enough
> with os.path.  However, os.path makes no distinction between a
> regular file and a mask, eg filename.txt or *.txt.  I guess I'll have
> to have a second set of tests to see if the filename contains any
> wildcards..?

As Andreas wrote, that won't be necessary on Unix systems, since the 
shell already expands the wildcards before passing it to your program.

On Windows you can use the glob module to expand the wildcards.

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven



More information about the Tutor mailing list