Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40237

Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <bsk16@case.edu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'output': 0.04; 'subject:bug': 0.05; 'bug.': 0.07; 'root,': 0.07; 'python': 0.09; 'subject:modules': 0.09; 'underlying': 0.09; 'files.': 0.13; '2.7.3': 0.16; 'dirs,': 0.16; 'sorts': 0.16; 'subject: \n ': 0.16; 'wrote:': 0.17; 'specify': 0.17; 'windows': 0.19; 'sort': 0.21; 'bug?': 0.22; 'linux': 0.24; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; '(maybe': 0.29; 'fri,': 0.30; 'function': 0.30; 'file': 0.32; 'print': 0.32; 'to:addr:python-list': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'whatever': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'test': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'skip:o 20': 0.38; 'system.': 0.39; 'to:addr:python.org': 0.39; 'think': 0.40; 'subject:, ': 0.61; 'below:': 0.71; 'hand': 0.82; '2013': 0.84; 'different.': 0.84; 'abc': 0.91
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-received:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding :x-gm-message-state; bh=dfUgl8SAfLD7tJgexVbhhwsNNK/Ak47iPArjQXenGBs=; b=Hc3NlfPIguy6ewG+TIik8+dNDdrtn5yBQw491gupVy2PgDd9ULb87USr9rRHpd+5Z+ olU7qwQvcXarxf1rAYS4Ct5KZVGpFsdWKpDQVxg4PuOJdLSgwpgV+LrHtGNKclxy2QfK grqWbs13UFfJaCvflo5r0e2vNL/ZbBSzcMc2j2+5AUrgcVoFDjSkg66ALECtcHTohp+n Pm+KIKMCiURz5ffWtOCI3xwgDLwYxZAtdLGUs3wbjoA2Hg9AUegip9OYKg8IKqh7RxPZ oUUGRWK7SUZ1jZVOjhpBP19J6vFiIgoKsyWlC10N0ilMJ7wGeNycfChQuAEblEmROZQZ ylbQ==
X-Received by 10.60.12.41 with SMTP id v9mr7814517oeb.75.1362128473021; Fri, 01 Mar 2013 01:01:13 -0800 (PST)
MIME-Version 1.0
X-Received by 10.60.12.41 with SMTP id v9mr7814514oeb.75.1362128472932; Fri, 01 Mar 2013 01:01:12 -0800 (PST)
In-Reply-To <270cf08f-aefd-436c-a3e6-4adf373d5356@googlegroups.com>
References <270cf08f-aefd-436c-a3e6-4adf373d5356@googlegroups.com>
Date Fri, 1 Mar 2013 01:01:12 -0800
Subject Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?
From Benjamin Kaplan <benjamin.kaplan@case.edu>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Gm-Message-State ALoCoQnuuciJIVIoKAQ9p3kVXzSOVq6KRyrm6vXer+DlDnHVlxCZu2xXQLMZRoYBleOCO2jQHGjmEP3pB+RWaU3wCurkcaCmQCIGVz7CllNG3gkdifilIiCZ1ZYEj9ODV7HpJxZps4hf6z4+tlAsevBUX7bkonMlOg==
X-Junkmail-Whitelist YES (by domain whitelist at mpv2.tis.cwru.edu)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2709.1362128671.2939.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362128671 news.xs4all.nl 6905 [2001:888:2000:d::a6]:35279
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40237

Show key headers only | View raw


On Fri, Mar 1, 2013 at 12:43 AM, Honghe Wu <leopardsaga@gmail.com> wrote:
> env: python 2.7.3
>
> 6 test files' name in a directory as below:
> 12ab  Abc  Eab  a1bc  acd  bc
>
> the following is test code:
> for root, dirs, files in os.walk(os.getcwd()):
>     print files
>
> the output in win32 platform is:
> ['12ab', 'a1bc', 'Abc', 'acd', 'bc', 'Eab']
>
> but in linux is:
> ['Eab', 'acd', 'a1bc', '12ab', 'bc', 'Abc' ]
>
> they are so different. a bug?
> --

The function doesn't specify a particular order, just that it will
hand you a list of files. It grabs those from the underlying file
system. It looks like Windows sorts it alphabetically and Linux just
does whatever (maybe sorted by creation time?). I don't think it's a
bug. If the order matters to you, sort it yourself.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

In win32 and linux platform, os modules has diffreent output order, is it a bug? Honghe Wu <leopardsaga@gmail.com> - 2013-03-01 00:43 -0800
  Re: In win32 and linux platform, os modules has diffreent output order, is it a bug? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-03-01 01:01 -0800
  Re: In win32 and linux platform, os modules has diffreent output order, is it a bug? Chris Rebert <clp2@rebertia.com> - 2013-03-01 00:55 -0800
  Re: In win32 and linux platform, os modules has diffreent output order, is it a bug? Honghe Wu <leopardsaga@gmail.com> - 2013-03-01 17:24 +0800
    Re: In win32 and linux platform, os modules has diffreent output order, is it a bug? Nobody <nobody@nowhere.com> - 2013-03-01 12:56 +0000

csiph-web