Mega Code Archive

 
Categories / Python Tutorial / File
 

Module Attributes to Aid in Multi-platform Development

import os print os.linesep      # String used to separate lines in a file print os.sep        # String used to separate file pathname components print os.pathsep    # String used to delimit a set of file pathnames print os.curdir        # String name for current working directory print os.pardir        # String name for parent (of current working directory) path = "c:/" print path print os.path.isfile(path) print os.path.isdir(path) print os.path.split(path) print os.path.splitext(os.path.basename(path))