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: 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: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=182.242.155.61; posting-account=Z1-aQQoAAADvnuKxr9sysEiuPIcBNfjX References: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: 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 =E5=9C=A8 2012=E5=B9=B411=E6=9C=886=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=8CUTC+= 8=E4=B8=8B=E5=8D=881=E6=97=B624=E5=88=8641=E7=A7=92=EF=BC=8CChris Angelico= =E5=86=99=E9=81=93=EF=BC=9A > On Tue, Nov 6, 2012 at 4:19 PM, iMath wrote: >=20 > > How to only get a list of the names of the non-directory files in curre= nt directory ('.')? >=20 > > (Note excluding its subdirectories ). >=20 > > >=20 > > I need the code : ) >=20 >=20 >=20 > Start by getting a list of names of everything in the current directory. >=20 >=20 >=20 > Then filter that list by testing each one to see if it's a directory. >=20 >=20 >=20 > Tip: The second step can be done with os.path.isdir >=20 >=20 >=20 > Put some code together and try it. If you have trouble, post your >=20 > code, any exception traceback you get, and what you're having >=20 > difficulty with, and we'll go on from there. >=20 >=20 >=20 > Have fun! >=20 >=20 >=20 > ChrisA how to get a list of names of everything in the current directory ?