os path exists( ' :\users\brian'false os path exists( ' :\users\default'true os path getsize( ' :\autoexec bat' the os path isdir and os path isfile calls tell us whether filename is directory or simple fileboth return false if the named file does not exist (that isnonexistence implies negationwe also get calls for splitting and joining directory path stringswhich automatically use the directory name conventions on the platform on which python is runningos path split( ' :\temp\data txt'(' :\\temp''data txt'os path join( ' :\temp''output txt'' :\\temp\\output txtname ' :\temp\data txtos path dirname(name)os path basename(name(' :\\temp''data txt'windows paths name '/home/lutz/temp/data txtos path dirname(name)os path basename(name('/home/lutz/temp''data txt'unix-style paths os path splitext( ' :\pp thed\examples\pp \pydemos pyw'(' :\\pp thed\\examples\\pp \\pydemos'pyw'os path split separates filename from its directory pathand os path join puts them back together--all in entirely portable fashion using the path conventions of the machine on which they are called the dirname and basename calls here return the first and second items returned by split simply as convenienceand splitext strips the file extension (after the last subtle pointit' almost equivalent to use string split and join method calls with the portable os sep stringbut not exactlyos sep '\\pathname ' :\pp thed\examples\pp \pydemos pywos path split(pathname(' :\\pp thed\\examples\\pp ''pydemos pyw'split file from dir pathname split(os sep[' :''pp thed''examples''pp ''pydemos pyw'split on every slash os sep join(pathname split(os sep)' :\\pp thed\\examples\\pp \\pydemos pywos path join(*pathname split(os sep)' :pp thed\\examples\\pp \\pydemos pywintroducing the os module