[code.view]

[top] / python / PyMOTW / ospath / ospath_tests.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """Test properties of a file.
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     import os.path
     
     for file in [ __file__, os.path.dirname(__file__), '/', './broken_link']:
         print 'File        :', file
         print 'Absolute    :', os.path.isabs(file)
         print 'Is File?    :', os.path.isfile(file)
         print 'Is Dir?     :', os.path.isdir(file)
         print 'Is Link?    :', os.path.islink(file)
         print 'Mountpoint? :', os.path.ismount(file)
         print 'Exists?     :', os.path.exists(file)
         print 'Link Exists?:', os.path.lexists(file)
         print
     

[top] / python / PyMOTW / ospath / ospath_tests.py

contact | logmethods.com