file test operator

Chris Liechti cliechti at gmx.net
Sat Aug 10 20:38:18 EDT 2002


xd_pan at yahoo.com (Xiangdong Pan) wrote in 
news:a975fedd.0208101504.66ef0e1d at posting.google.com:
> I'm wondering whether python has build-in file test operators, such as
> -x for file is executable or -e for file exists or some similar
> functions, like perl does. If not, how could I perform these kinds of
> tests?

look at the "os" module.
http://python.org/doc/current/lib/os-file-dir.html
namely the function os.stat() for attributes and

http://python.org/doc/current/lib/module-os.path.html
e.g. os.path.exist()

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list