import os os.path.exists('/etc/passwd') True os.path.exists('/tmp/spam') False
Is a regular file os.path.isfile('/etc/passwd') True
Is a directory os.path.isdir('/etc/passwd') False
Is a symbolic link os.path.islink('/usr/local/bin/python3') True
Get the file linked to os.path.realpath('/usr/local/bin/python3') '/usr/local/bin/python3.3'
os.path.getsize('/etc/passwd') 3669 os.path.getmtime('/etc/passwd') 1272478234.0 import time time.ctime(os.path.getmtime('/etc/passwd')) 'Wed Apr 28 13:10:34 2010'