On Fri, May 2, 2008 at 1:38 PM, Spencer Parker <[EMAIL PROTECTED]> wrote:
> Well...it gives me the entire path...I am not running this script from the
> actual directory...I am running it from a secure user directory that only
> has certain access rights.  During the os.path.dirname gives me the entire
> directory path...I just need to last part of it is all. out of
> '/xen/domains2/machinename/disk.img all I need is 'machinename'

In [1]: import os

In [2]: path = '/xen/domains2/machinename/disk.img'

In [3]: os.path.basename(os.path.dirname(path))
Out[3]: 'machinename'

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to