On Fri, Jan 14, 2011 at 1:21 AM, Alan Gauld wrote:
for t in os.walk('Root'):
>
> ... print t
> ...
> And the result is:('Root', ['D1', 'D2', 'D3'], ['FA.txt', 'FB.txt'])
> ('Root/D1', ['D1-1'], ['FC.txt'])
As I only need the first result presented I didn't favor os.walk, yet
tried it any
"ingo" wrote
at the os.walk() function for traversing directory trees? It may be
all
you need.
Yes, but I'm not confident with it (the more reason to use it you
will say :) ).
Quite. A simple tree printout looks like this:
for t in os.walk('Root'):
...print t
...
And the result is
On Thu, Jan 13, 2011 at 6:30 PM, Alan Gauld wrote:
> Its not clear what exactly the sort criteria is,
sorry Alan, I meant that I want to keep the order as is.
> however have you looked
> at the os.walk() function for traversing directory trees? It may be all
> you need.
Yes, but I'm not confid
It's like the were psychic...or intuitive .
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
> Its not clear what exactly the sort criteria is, however have you looked
> at the os.walk() function for traversing directory trees? It may be all
> you need.
it's amazing what the designers of the builtins left for your disposal.
___
Tutor maillist
"ingo" wrote
I have a path
path =
'Audio/site-packages/pygame/examples/macosx/aliens_app_example/English.lproj'
I'd like to turn taht into a list with a certain structure and
order:
Its not clear what exactly the sort criteria is, however have you
looked
at the os.walk() function for t
On Thu, Jan 13, 2011 at 1:51 PM, Christian Witts wrote:
> First split your path into segments, then iterate over those segments and
> build your new list (item one being the current segment, and part two a
> joined string of previous segments).
>
thanks Christian,
path =
'Audio/site-packages/py
On 13/01/2011 14:33, ingo wrote:
Dear all,
a probably simple problem I can't get my head around at the moment
(old age?), some input would be appreciated.
I have a path
path =
'Audio/site-packages/pygame/examples/macosx/aliens_app_example/English.lproj'
I'd like to turn taht i