On Jul 29, 2010, at 11:46 AM, Malcolm Greene wrote:
> What terminology (and/or variable naming convention) do you use
> to refer to the following:
>
> - just the base part of a file name (no directory or extension),
> eg. base
> - just the file name (base and extension), eg. base.ext
> - just the path to the file name, eg. c:\directory\
> - the full path to the file including the file name, eg.
> c:\directory\base.ext
In Python, the os.path module defines several pathing functions;
perhaps their names may be helpful:
import os
full = "/home/ed/base.ext"
os.path.basename(full)
'base.ext'
os.path.dirname(full)
'/home/ed'
os.path.splitdrive(full)
('', '/home/ed/base.ext')
os.path.split(full)
('/home/ed', 'base.ext')
os.path.splitext(full)
('/home/ed/base', '.ext')
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.