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


Groups > comp.lang.python > #32849

Re: How to only get a list of the names of the non-directory files in current directory ('.')?

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <redstone-cold@163.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'exception': 0.03; 'received:209.85.223': 0.03; 'subject:How': 0.09; 'excluding': 0.09; 'subject:files': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; '(note': 0.16; 'subject: \n ': 0.16; 'subject:non': 0.16; 'wrote:': 0.17; 'directory.': 0.17; 'code,': 0.18; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'testing': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'there.': 0.28; 'subject:list': 0.28; 'post': 0.28; 'code': 0.31; 'getting': 0.33; 'traceback': 0.33; 'received:google.com': 0.34; 'done': 0.34; 'list': 0.35; 'filter': 0.35; 'nov': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'step': 0.39; 'subject:-': 0.40; 'your': 0.60; 'skip:n 10': 0.63; 'difficulty': 0.65; 'subject:get': 0.81; 'fun!': 0.95
Newsgroups comp.lang.python
Date Tue, 6 Nov 2012 15:12:46 -0800 (PST)
In-Reply-To <mailman.3310.1352179480.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=182.242.155.61; posting-account=Z1-aQQoAAADvnuKxr9sysEiuPIcBNfjX
References <d9b687d7-e982-4a7c-b1f9-ef38ec6ce183@googlegroups.com> <mailman.3310.1352179480.27098.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 182.242.155.61
MIME-Version 1.0
Subject Re: How to only get a list of the names of the non-directory files in current directory ('.')?
From iMath <redstone-cold@163.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
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>
Message-ID <mailman.3345.1352243569.27098.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352243569 news.xs4all.nl 6908 [2001:888:2000:d::a6]:58008
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32849

Show key headers only | View raw


在 2012年11月6日星期二UTC+8下午1时24分41秒,Chris Angelico写道:
> On Tue, Nov 6, 2012 at 4:19 PM, iMath <redstone-cold@163.com> wrote:
> 
> > How to only get a list of the names of the non-directory files in current directory ('.')?
> 
> > (Note excluding its subdirectories ).
> 
> >
> 
> > I need the code : )
> 
> 
> 
> Start by getting a list of names of everything in the current directory.
> 
> 
> 
> Then filter that list by testing each one to see if it's a directory.
> 
> 
> 
> Tip: The second step can be done with os.path.isdir
> 
> 
> 
> Put some code together and try it. If you have trouble, post your
> 
> code, any exception traceback you get, and what you're having
> 
> difficulty with, and we'll go on from there.
> 
> 
> 
> Have fun!
> 
> 
> 
> ChrisA

how to get a list of names of everything in the current directory ?

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


Thread

How to only get a list of the names of the non-directory files in current directory ('.')? iMath <redstone-cold@163.com> - 2012-11-05 21:19 -0800
  Re: How to only get a list of the names of the non-directory files in current directory ('.')? Chris Angelico <rosuav@gmail.com> - 2012-11-06 16:24 +1100
    Re: How to only get a list of the names of the non-directory files in current directory ('.')? iMath <redstone-cold@163.com> - 2012-11-06 15:12 -0800
      RE: How to only get a list of the names of the non-directory files in current directory ('.')? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-06 23:41 +0000
      Re: How to only get a list of the names of the non-directory files in current directory ('.')? emile <emile@fenx.com> - 2012-11-13 10:16 -0800
      Re: How to only get a list of the names of the non-directory files in current directory ('.')? Chris Angelico <rosuav@gmail.com> - 2012-11-14 07:53 +1100
        Re: How to only get a list of the names of the non-directory files in current directory ('.')? John Gordon <gordon@panix.com> - 2012-11-13 21:05 +0000
          Re: How to only get a list of the names of the non-directory files in current directory ('.')? Chris Angelico <rosuav@gmail.com> - 2012-11-14 08:19 +1100
          Re: How to only get a list of the names of the non-directory files in current directory ('.')? emile <emile@fenx.com> - 2012-11-13 13:24 -0800
    Re: How to only get a list of the names of the non-directory files in current directory ('.')? iMath <redstone-cold@163.com> - 2012-11-06 15:12 -0800
      Re: How to only get a list of the names of the non-directory files in current directory ('.')? John Gordon <gordon@panix.com> - 2012-11-06 23:23 +0000

csiph-web