[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how having the basename of a file or directory
From: |
Stephen J. Turnbull |
Subject: |
Re: how having the basename of a file or directory |
Date: |
Wed, 02 Feb 2011 01:26:56 +0900 |
Karl Fogel writes:
> "Stephen J. Turnbull" <address@hidden> writes:
> > > or creating a basename function
> >
> >Un-Pythonic. But then, this isn't Python, so I guess it's OK. ;-)
>
> $ python
> Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
> >>> import os.path
> >>> os.path.basename("/home/kfogel/README")
> 'README'
> >>> quit()
> $
You know what I mean. "Not every three-line function needs to be a
built-in." AFAIK Python doesn't have an equivalent to
file-name-directory; you need to write that yourself.