Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 0.20 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Path to a file without basename
  2. >>> filepath
  3. '/a/path/to/my/file.txt'
  4. >>> os.path.dirname(filepath)
  5. '/a/path/to/my'
  6. >>>
  7.        
  8. (dirname, filename) = os.path.split(path)
  9.        
  10. os.path.dirname('/test/one')