On Sun, 25 Jun 2017 08:18:45 -0600
Michael Torrie wrote:
> On 06/25/2017 06:19 AM, Rod Person wrote:
> > But doing a simple ls of that directory show it is unicode but the
> > replacement of the offending character.
> >
> > http://rodperson.com/graphics/uc/ls.png
>
> Now that is really strang
Rod Person wrote:
> Ok...so after reading all the replies in the thread, I thought I would
> be easier to send a general reply and include some links to screenshots.
>
> As Peter mention, the logic thing to do would be to fix the file name
> to what I actually thought it was and if this was for w
On 06/25/2017 06:19 AM, Rod Person wrote:
> But doing a simple ls of that directory show it is unicode but the
> replacement of the offending character.
>
> http://rodperson.com/graphics/uc/ls.png
Now that is really strange. Your OS seems to not recognize that the
filename is in UTF-8. I suspec
Ok...so after reading all the replies in the thread, I thought I would
be easier to send a general reply and include some links to screenshots.
As Peter mention, the logic thing to do would be to fix the file name
to what I actually thought it was and if this was for work that
probably what I woul
On Sun, 25 Jun 2017 02:23:15 -0700, wxjmfauth wrote:
> Le samedi 24 juin 2017 21:10:47 UTC+2, alister a écrit :
>> On Sat, 24 Jun 2017 14:57:21 -0400, Rod Person wrote:
>>
>> > \xe2\x80\x99,
>>
>> because the file name has been created using "Right single quote"
>> instead of apostrophe, the gly
Steve D'Aprano wrote:
> On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote:
>> if everything worked correctly? Though I don't understand why the OP
>> doesn't see
>>
>> '06 - Toddâ\x80\x99s Song (Post-Spiderland Song in Progress).flac'
>>
>> which is the repr() that I get.
>
> That's mojibake and
On Sun, 25 Jun 2017 04:57 pm, Peter Otten wrote:
> Steve D'Aprano wrote:
>
>> On Sun, 25 Jun 2017 07:17 am, Peter Otten wrote:
>>
>>> Then I'd fix the name manually...
>>
>> The file name isn't broken.
>>
>>
>> What's broken is parts of the OP's code which assumes that non-ASCII file
>> names
Steve D'Aprano wrote:
> On Sun, 25 Jun 2017 07:17 am, Peter Otten wrote:
>
>> Then I'd fix the name manually...
>
> The file name isn't broken.
>
>
> What's broken is parts of the OP's code which assumes that non-ASCII file
> names are broken...
Hm, the OP says
'06 - Todd\xe2\x80\x99s Song (
On Sun, 25 Jun 2017 07:17 am, Peter Otten wrote:
> Then I'd fix the name manually...
The file name isn't broken.
What's broken is parts of the OP's code which assumes that non-ASCII file names
are broken...
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
e
Rod Person wrote:
> On Sat, 24 Jun 2017 21:28:45 +0200
> Peter Otten <__pete...@web.de> wrote:
>
>> Rod Person wrote:
>>
>> > Hi,
>> >
>> > I'm working on a program that will walk a file system and clean the
>> > id3 tags of mp3 and flac files, everything is working great until
>> > the follow
On 2017-06-24 20:47, Rod Person wrote:
On Sat, 24 Jun 2017 13:28:55 -0600
Michael Torrie wrote:
On 06/24/2017 12:57 PM, Rod Person wrote:
> Hi,
>
> I'm working on a program that will walk a file system and clean the
> id3 tags of mp3 and flac files, everything is working great until
> the fo
Can os.fsencode and os.fsdecode help? I've seen it somewhere.
I've never used it.
To fix encodings, sometimes I use the module ftfy
Greetings
Andre
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 24 Jun 2017 13:28:55 -0600
Michael Torrie wrote:
> On 06/24/2017 12:57 PM, Rod Person wrote:
> > Hi,
> >
> > I'm working on a program that will walk a file system and clean the
> > id3 tags of mp3 and flac files, everything is working great until
> > the follow file is found
> >
> > '06
On Sat, 24 Jun 2017 21:28:45 +0200
Peter Otten <__pete...@web.de> wrote:
> Rod Person wrote:
>
> > Hi,
> >
> > I'm working on a program that will walk a file system and clean the
> > id3 tags of mp3 and flac files, everything is working great until
> > the follow file is found
> >
> > '06 - Tod
Rod Person wrote:
> Hi,
>
> I'm working on a program that will walk a file system and clean the id3
> tags of mp3 and flac files, everything is working great until the
> follow file is found
>
> '06 - Todd's Song (Post-Spiderland Song in Progress).flac'
>
> for some reason that I can't understa
On 06/24/2017 12:57 PM, Rod Person wrote:
> Hi,
>
> I'm working on a program that will walk a file system and clean the id3
> tags of mp3 and flac files, everything is working great until the
> follow file is found
>
> '06 - Todd's Song (Post-Spiderland Song in Progress).flac'
>
> for some reaso
On 2017-06-24 19:57, Rod Person wrote:
Hi,
I'm working on a program that will walk a file system and clean the id3
tags of mp3 and flac files, everything is working great until the
follow file is found
'06 - Todd's Song (Post-Spiderland Song in Progress).flac'
for some reason that I can't unde
On Saturday, June 24, 2017 at 12:07:05 PM UTC-7, Rod Person wrote:
> Hi,
>
> I'm working on a program that will walk a file system and clean the id3
> tags of mp3 and flac files, everything is working great until the
> follow file is found
>
> '06 - Todd's Song (Post-Spiderland Song in Progress).
On Sat, 24 Jun 2017 14:57:21 -0400, Rod Person wrote:
> \xe2\x80\x99,
because the file name has been created using "Right single quote" instead
of apostrophe, the glyphs look identical in many fonts.
--
"If you understand what you're doing, you're not learning anything."
--
ecu_jon wrote:
> yes i agree breaking stuff into smaller chunks is a good way to do it.
> even were i to do something like
>
> def safe_copy()
> f1=file(files ,'rb')
> f2 = file(os.path.join(currentdir,fname,files))
> truth = md5.new(f1.read()).digest() ==
> md5.new(f2.read()).dig
yes i agree breaking stuff into smaller chunks is a good way to do it.
even were i to do something like
def safe_copy()
f1=file(files ,'rb')
f2 = file(os.path.join(currentdir,fname,files))
truth = md5.new(f1.read()).digest() ==
md5.new(f2.read()).digest()
if truth == 0:
ecu_jon wrote:
> so i am trying to add md5 checksum calc to my file copy stuff, to make
> sure the source and dest. are same file.
> i implemented it fine with the single file copy part. something like :
> for files in sourcepath:
> f1=file(files ,'rb')
> try:
> shutil.
You're not really supposed to call into the md5 module directly anymore; you
might use hashlib instead.
But actually, using a cryptographic hash doesn't really help comparing just
one pair of files; it's more certain to do a block by block comparison, and
the I/O time is roughly the same - actuall
You have no guarantee that on the next run the directories will be
visited in the same order as in the first run (this could depend on the
filesystem). So then remembering a last directory won't do it. You could
write each completed directory name to a file, and then on the second
run check whether
Steve Howell wrote:
If that's the case, then you might be able to get away with just
leaving some kind of breadcrumbs whenever you've successfully
processed a directory or a file,
Unless you're indexing a read-only device (whether hardware
read-only like a CD, or permission-wise read-only like
On Wed, 17 Mar 2010 20:08:48 -0700, alex23 wrote:
> Steven D'Aprano wrote:
>> # Untested
>> last_visited = open("last_visited.txt", 'r').read()
>> for root, dirs, files in os.walk(last_visited or basedir):
>> open("last_visited.txt", 'w').write(root) run program
>
> Wouldn't this only walk
On Mar 17, 3:04 pm, Keir Vaughan-taylor wrote:
> I am traversing a large set of directories using
>
> for root, dirs, files in os.walk(basedir):
> run program
>
> Being a huge directory set the traversal is taking days to do a
> traversal.
> Sometimes it is the case there is a crash because of
Keir Vaughan-taylor wrote:
I am traversing a large set of directories using
for root, dirs, files in os.walk(basedir):
run program
Being a huge directory set the traversal is taking days to do a
traversal.
Sometimes it is the case there is a crash because of a programming
error.
As each dir
Steven D'Aprano wrote:
> # Untested
> last_visited = open("last_visited.txt", 'r').read()
> for root, dirs, files in os.walk(last_visited or basedir):
> open("last_visited.txt", 'w').write(root)
> run program
Wouldn't this only walk the directory the exception occured in and not
the rem
En Wed, 17 Mar 2010 19:04:14 -0300, Keir Vaughan-taylor
escribió:
I am traversing a large set of directories using
for root, dirs, files in os.walk(basedir):
run program
Being a huge directory set the traversal is taking days to do a
traversal.
Sometimes it is the case there is a crash
On Wed, 17 Mar 2010 15:04:14 -0700, Keir Vaughan-taylor wrote:
> I am traversing a large set of directories using
>
> for root, dirs, files in os.walk(basedir):
> run program
>
> Being a huge directory set the traversal is taking days to do a
> traversal.
> Sometimes it is the case there is
> On Tue, Aug 4, 2009 at 10:48 PM, Chris Rebert wrote:
>> On Tue, Aug 4, 2009 at 7:06 PM, Michael Savarese wrote:
>> > Greetings
>> > Python newbie here, and thanks to all who have helped me previously.
>> > Is there a way of grabbing file attributes while traversing with os.walk()?
>> > It would
On Tue, Aug 4, 2009 at 7:06 PM, Michael Savarese wrote:
> Greetings
> Python newbie here, and thanks to all who have helped me previously.
> Is there a way of grabbing file attributes while traversing with os.walk()?
> It would be advantageous to have date modified and file size along with the
> fi
En Thu, 25 Jun 2009 11:15:15 -0300, Amos Anderson
escribió:
Thank you. That works very well when writing to a text file but what is
the
equivalent when writing the information to stdout using print?
See this recent post:
http://comments.gmane.org/gmane.comp.python.general/627850
--
Gabri
Thank you. That works very well when writing to a text file but what is the
equivalent when writing the information to stdout using print?
Sorry when I originally replied I sent it directly and it didn't go to the
list.
On Thu, Jun 25, 2009 at 12:57 AM, Mark Tolonen
> wrote:
>
> "Amos Anderson"
"Amos Anderson" wrote in message
news:a073a9cf0906242007k5067314dn8e9d7b1c6da62...@mail.gmail.com...
I've run into a bit of an issue iterating through files in python 3.0 and
3.1rc2. When it comes to a files with '\u200b' in the file name it gives
the
error...
Traceback (most recent call la
Eric Wertman wrote:
I do this, mabye a no-no?
It is a roundabout way to do multiple assignment:
import os
for root,dirs,files in os.walk(dir) : break
root,dirs,files = os.walk(dir).next #2.x
root,dirs,files = next(os.walk(dir))#3.x
--
http://mail.python.org/mailman/listinfo/python-lis
I do this, mabye a no-no?
import os
for root,dirs,files in os.walk(dir) : break
--
http://mail.python.org/mailman/listinfo/python-list
Lawrence D'Oliveiro wrote:
Won't that return any subdirectories as well as files?
sure, as was discussed in this very thread two days ago.
--
http://mail.python.org/mailman/listinfo/python-list
In message <[EMAIL PROTECTED]>, Fredrik
Lundh wrote:
> Lanny wrote:
>
>> How would one make a list of the files in the top directory
>> using os.walk.
>>
>> I need to pick a random file from said list.
>
> if you want a list of files from a single directory, use listdir, not
> walk:
>
>
Lanny wrote:
How would one make a list of the files in the top directory
using os.walk.
I need to pick a random file from said list.
Thanks.
-- Posted on news://freenews.netfront.net - Complaints to [EMAIL PROTECTED] --
how about:
import os
x = os.walk('/')
(root,dirs,files) = x.next
On Jul 23, 10:26 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> random.choice(filter(os.path.isfile, glob.glob("/*")))
>
> isn't that bad, though.
I'll agree to that.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 23, 10:11 pm, Larry Bates <[EMAIL PROTECTED]> wrote:
> import glob
> random.choice([f for f in glob.glob(root, "*")])
glob.glob only accepts one argument though, did you mean root + "*"?
It also returns folders as well as files, though, and the list
comprehension is not necessary given it
alex23 wrote:
if you want a list of files from a single directory, use listdir, not walk:
>>> import os, random
>>> random.choice(os.listdir("/"))
'python25'
This will include folders as well, though, which isn't what the OP
asked for.
as illustrated by my example (cut and
Fredrik Lundh wrote:
Lanny wrote:
How would one make a list of the files in the top directory
using os.walk.
I need to pick a random file from said list.
if you want a list of files from a single directory, use listdir, not walk:
>>> import os, random
>>> random.choice(os.listdir(
On Jul 23, 5:22 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> if you want a list of files from a single directory, use listdir, not walk:
>
> >>> import os, random
> >>> random.choice(os.listdir("/"))
> 'python25'
This will include folders as well, though, which isn't what the O
Lanny wrote:
How would one make a list of the files in the top directory
using os.walk.
I need to pick a random file from said list.
if you want a list of files from a single directory, use listdir, not walk:
>>> import os, random
>>> random.choice(os.listdir("/"))
'python25'
On Jul 24, 11:52 am, "Lanny" <[EMAIL PROTECTED]> wrote:
> How would one make a list of the files in the top directory
> using os.walk.
>
> I need to pick a random file from said list.
So you -only- want the files from one directory?
Try: _, _, files = os.walk('/top/folder/here').next()
The singl
En Sat, 14 Jun 2008 19:06:16 -0300, <[EMAIL PROTECTED]> escribió:
> I'm using os.walk as follows:
>
> (basedir, pathnames, files) = os.walk("results", topdown=True)
>
> and I'm getting the error:
>
> ValueError: too many values to unpack
>
>> From my googling, that means:
>
> This is the standard
On Jun 14, 7:11 pm, Larry Bates <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hi,
>
> > I'm using os.walk as follows:
>
> > (basedir, pathnames, files) = os.walk("results", topdown=True)
>
> > and I'm getting the error:
>
> > ValueError: too many values to unpack
>
> > From my googling,
[EMAIL PROTECTED] wrote:
> Is there any other reason I might get that error?
Yes, you are using it the wrong way. The correct way is
for root, dirs, files in os.walk(path):
do something
os.walk returns an iterator which yields root, dirs and files for each
iteration.
Christian
--
http://ma
[EMAIL PROTECTED] wrote:
Hi,
I'm using os.walk as follows:
(basedir, pathnames, files) = os.walk("results", topdown=True)
and I'm getting the error:
ValueError: too many values to unpack
From my googling, that means:
This is the standard message when Python tries to unpack a tuple
into fewe
27 Oct 2007 17:38:10 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>:
> On Sat, 27 Oct 2007 18:07:44 +0200, Martin Marcher wrote:
> > I'm playing around with os.walk and I made up del_tree(path) which I
> > think is correct (in terms of the algorithm, but not as python wants
> > it :)).
>
> It's
On Sat, 27 Oct 2007 18:07:44 +0200, Martin Marcher wrote:
> Hello,
>
> I'm playing around with os.walk and I made up del_tree(path) which I
> think is correct (in terms of the algorithm, but not as python wants
> it :)).
It's not correct in terms of the algorithm if you take the algorithm of
`os
Martin Marcher wrote:
> Hello,
>
> I'm playing around with os.walk and I made up del_tree(path) which I
> think is correct (in terms of the algorithm, but not as python wants
> it :)).
>
> As soon as some directory is deleted the iterator of os.walk chokes.
> OK that is somehow clear to me as it
In <[EMAIL PROTECTED]>, Alex S wrote:
> os.walk return hex excape sequence inside a files name, and when i try
> to feed it back to os.remove i get
>
> OSError: [Errno 22] Invalid argument:
> 'C:\\Temp\\?p?\xbfS\xbf\xac?G\xaba ACDSee \xbb?a??n a???\xac\xb5\xbfn.exe'
There is no hex escape in th
Alex S wrote:
> Hi,
> os.walk return hex excape sequence inside a files name, and when i try
> to feed it back to os.remove i get
>
> OSError: [Errno 22] Invalid argument:
> 'C:\\Temp\\?p?\xbfS\xbf\xac?G\xaba ACDSee \xbb?a??n a???\xac\xb5\xbfn.exe'
It's not escape sequences that are the problem bu
Kent Johnson wrote:
> The Prophet wrote:
> > As my first Python script, I am trying to make a program that recurses
> > a directory searching for files whose names match a pattern.
>
> If your patterns are simple (supported by fnmatch), the path module
> makes this very easy:
> import path
> for f
The Prophet wrote:
> As my first Python script, I am trying to make a program that recurses
> a directory searching for files whose names match a pattern.
If your patterns are simple (supported by fnmatch), the path module
makes this very easy:
import path
for f in path.path(dirname).walkfiles('
> As my first Python script, I am trying to make a program that recurses
> a directory searching for files whose names match a pattern. I have a
> basic idea of what the regexp would look like
You probably don't need regexp for this, just use the fnmatch module
http://docs.python.org/lib/module-f
>> root, dirs, files = os.walk(dirname)
If you want to do it this way, you need to stop it after the first one:
root, dirs, files = os.walk(dirname).next()
print root
print dirs
print files
see this thread
http://tinyurl.com/rmyo4
--
http://mail.python.org/mailman/listinfo/python-list
Neat. And looks better, at least on my machine, if you had a tab or two
and an extra \n after the dirs.
rick
for filepath, dirs, files in os.walk(root):
#you're looking at the "dirs" and "files" in filepath
print "Currently in %s" % filepath
print "\t[Directories in %s]" %
> but I am stuck with incorrect understanding of
> os.walk. I've tried:
>
> root, dirs, files = os.walk(dirname)
os.walk returns an iteratable sequence of those tuples. Thus,
you want to have
for filepath, dirs, files in os.walk(dirname):
#you're looking at the "dirs" and "files" in fi
George Sakkis wrote:
> Or a bit more efficiently (no need to allocate a new list for storing
> files+dirs):
>
> from itertools import chain
> for root, dirs, files in os.walk(path):
> for fs_object in chain(files,dirs):
> ADD fs_object to dictionary
I like that! itertools is
[rtilley]
> When working with file and dir info recursively on Windows XP. I'm going
> about it like this:
>
> for root, dirs, files in os.walk(path):
> for f in files:
> ADD F to dictionary
> for d in dirs:
> ADD D to dictionary
>
> Is it possible to do something such a
rtilley wrote:
> Duncan Booth wrote:
>
>> How about just concatentating the two lists:
>>
>>> for root, dirs, files in os.walk(path):
>>
>>for fs_object in files + dirs:
>>
>>> ADD fs_object to dictionary
>
>
> Thank you Duncan! that solves the problem perfectly!
Or a bit more effi
rtilley wrote:
> Just to clarify. In this particular case, I do not need to differentiate
> between files and dirs... so would it be possible to do something such
> as this:
>
How about just concatentating the two lists:
> for root, dirs, files in os.walk(path):
> for fs_object in files,
rtilley wrote:
> Hello,
>
> When working with file and dir info recursively on Windows XP. I'm going
> about it like this:
>
> for root, dirs, files in os.walk(path):
> for f in files:
> ADD F to dictionary
> for d in dirs:
> ADD D to dictionary
>
> Is it possible to do
Duncan Booth wrote:
> How about just concatentating the two lists:
>
>>for root, dirs, files in os.walk(path):
>for fs_object in files + dirs:
>> ADD fs_object to dictionary
Thank you Duncan! that solves the problem perfectly!
--
http://mail.python.org/mailman/listinfo/python-li
On Thu, 10 Mar 2005 20:11:10 +0100, Uwe Becher <[EMAIL PROTECTED]> wrote:
> You would need a wrapper to retrieve all logical drives using
> win32api.GetLogicalDriveStrings(),check the drive type with
> win32file.GetDriveType() and then os.walk() those local fixed drives.
http://groups-beta.google.
rbt wrote:
More of an OS question than a Python question, but it is Python related
so here goes:
When I do os.walk('/') on a Linux computer, the entire file system is
walked. On windows, however, I can only walk one drive at a time (C:\,
D:\, etc.). Is there a way to make os.walk() behave on Wi
Tobiah wrote:
When I do os.walk('/') on a Linux computer, the entire file system is
walked. On windows, however, I can only walk one drive at a time (C:\,
D:\, etc.).
If this is a personal utility for one computer, and if you run XP on
that computer, then you have the ability to mount secondar
I don't think what you want would even work. You can't walk A:
unless a floppy is present, O/S will bark at you. You can't
walk D: (cdrom drive) unless a CDROM is present. What about
network drives??? Unlike Linux where these directories appear
to be empty if nothing is mounted Windows tries to
When I do os.walk('/') on a Linux computer, the entire file system is
walked. On windows, however, I can only walk one drive at a time (C:\,
D:\, etc.).
If this is a personal utility for one computer, and if you run XP on
that computer, then you have the ability to mount secondary drives
on to
rbt wrote:
More of an OS question than a Python question, but it is Python related
so here goes:
When I do os.walk('/') on a Linux computer, the entire file system is
walked. On windows, however, I can only walk one drive at a time (C:\,
D:\, etc.). Is there a way to make os.walk() behave on Wi
rbt <[EMAIL PROTECTED]> writes:
> Could someone demonstrate the correct/proper way to use os.walk() to
> skip certain files and folders while walking a specified path? I've
> read the module docs and googled to no avail and posted here about
> other os.walk issues, but I think I need to back up to
os.walk() is a generator. When you iterate over it, like in a for loop,
as
for r,ds,fs in os.walk(...):
r, ds and fs are set to new values at the beginning of each iteration.
If you want to end up with a list of files or dirs, rather than
processing them in the bodies of the file and dir for loop
Roel Schroeven wrote:
rbt wrote:
The problem I run into is that some of the files and dirs are not
removed while others are. I can be more specific and give exact examples
if needed. On WinXP, 'pagefile.sys' is always removed, while
'UsrClass.dat' is *never* removed, etc.
Keep in mind that the com
rbt wrote:
> The problem I run into is that some of the files and dirs are not
> removed while others are. I can be more specific and give exact examples
> if needed. On WinXP, 'pagefile.sys' is always removed, while
> 'UsrClass.dat' is *never* removed, etc.
Keep in mind that the comparisons are d
"rbt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Could someone demonstrate the correct/proper way to use os.walk() to skip
> certain files and folders while walking a specified path? I've read the
> module docs and googled to no avail and posted here about other os.walk
> is
[EMAIL PROTECTED] wrote:
every object in os.walk() returns a 3-tuple, like below, it seems your
code assumes it returns only a list of files.
for d in os.walk('c:\\temp'):
(dirpath, dirnames, filenames) = d
print dirpath
print dirnames
print filenames
Thank you, this
Title: RE: os.walk() usage
[rbt]
#- The problem I'm encountering is passing the list to other functions.
#- It's almost as if each function needs to build the list
#- itself (walk the
#- filesystem)... which gets in the way of what I was asked to
#- do (break
#- this thi
rbt wrote:
I'm trying to write very small, modular code as functions to break up a
big monolithic script that does a file system search for particular
strings. The script works well, but it's not easy to maintain or add
features to.
I'd like to have a function that builds a list of files with o
every object in os.walk() returns a 3-tuple, like below, it seems your
code assumes it returns only a list of files.
for d in os.walk('c:\\temp'):
(dirpath, dirnames, filenames) = d
print dirpath
print dirnames
print filenames
--
http://mail.python.org/mailman/lis
Terry Reedy <[EMAIL PROTECTED]> wrote:
> "Alex Martelli" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > for item in alist:
> >if isnasty(item):
> >alist.remove(item)
> >
> > changing the header to ``in alist[:]:'' or ``in list(alist):'' probably
> > makes this code
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> for item in alist:
>if isnasty(item):
>alist.remove(item)
>
> changing the header to ``in alist[:]:'' or ``in list(alist):'' probably
> makes this code work, but it still can't make it GOOD... good would be:
Adam DePrince <[EMAIL PROTECTED]> wrote:
> Each iteration of os.walk returns three parameters; one of those, dirs,
> is a list of directories within the current directory pointed at by
> root.
Yes, it does.
> Am I correct to assume that you beleve that by changing the contents of
> dir you will
[Adam DePrince]
> Each iteration of os.walk returns three parameters; one of those,
> dirs, is a list of directories within the current directory pointed at
> by root.
Right.
> Am I correct to assume that you beleve that by changing the
> contents of dir you will affect how os.walk traverses the
On Thu, 2004-12-16 at 14:45, Gabriel Cosentino de Barros wrote:
> Hi
>
> I'm new to the list. i found a bad behaviour of os.walk that i can
> reproduce 100% but didn't find an answer to why it does that
>
> I have the folowing tree:
>
> t:\dir1
> t:\dir1\2000
> t:\dir1\2001
> t:\dir1\content
>
[Gabriel Cosentino de Barros]
...
> for root, dirs, files in os.walk('t:\'):
> # -- do stuff
> print "working on", root
> # -- stuff done
>
> print 'DEBUG: dirs =', dirs
> for d in dirs:
> # -- remove archive
>
os.walk bug?---
for d in dirs:
# -- remove archive
if d[:2] == '20':
print "--- removing:", d
dirs.remove(d)
--
Please post in plain text, not html/rtf. It is easier to reply to.
Without looking at
91 matches
Mail list logo