BartlebyScrivener wrote:
> I don't know if it's "standard," but why not just:
>
> dir = './foo/bar/moo/lar/myfile.txt'
> dir.split('/')
>
> ['.', 'foo', 'bar', 'moo', 'lar', 'myfile.txt']
>
> rd
There's also os.path.sep, from the docs: "The character used by the
operating system to separate pathna
tac-tics wrote:
> I know about os.path.split(), but Is there any standard function for
> "fully" splitting a file's pathname? A function that is the opposite of
> the os.path.join() function? For example:
>
> >>> ret = myster_function(./foo/bar/moo/lar/myfile.txt)
> >>> print ret
> ['.', 'foo', 'b
y,
Richard.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of BartlebyScrivener
Sent: 10 July 2006 15:52
To: python-list@python.org
Subject: Re: Full splitting of a file's pathname
I don't know if it's "standard," but why not just:
I don't know if it's "standard," but why not just:
dir = './foo/bar/moo/lar/myfile.txt'
dir.split('/')
['.', 'foo', 'bar', 'moo', 'lar', 'myfile.txt']
rd
--
http://mail.python.org/mailman/listinfo/python-list
I know about os.path.split(), but Is there any standard function for
"fully" splitting a file's pathname? A function that is the opposite of
the os.path.join() function? For example:
>>> ret = myster_function(./foo/bar/moo/lar/myfile.txt)
>>> print ret
['.', 'foo', 'bar', 'moo', 'lar', 'myfile.txt