Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32804 > unrolled thread
| Started by | iMath <redstone-cold@163.com> |
|---|---|
| First post | 2012-11-05 21:19 -0800 |
| Last post | 2012-11-06 23:23 +0000 |
| Articles | 11 — 5 participants |
Back to article view | Back to comp.lang.python
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
| From | iMath <redstone-cold@163.com> |
|---|---|
| Date | 2012-11-05 21:19 -0800 |
| Subject | How to only get a list of the names of the non-directory files in current directory ('.')? |
| Message-ID | <d9b687d7-e982-4a7c-b1f9-ef38ec6ce183@googlegroups.com> |
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 : )
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-11-06 16:24 +1100 |
| Message-ID | <mailman.3310.1352179480.27098.python-list@python.org> |
| In reply to | #32804 |
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
[toc] | [prev] | [next] | [standalone]
| From | iMath <redstone-cold@163.com> |
|---|---|
| Date | 2012-11-06 15:12 -0800 |
| Message-ID | <31a0765f-c366-4f19-8d6c-bc95e0e51265@googlegroups.com> |
| In reply to | #32805 |
在 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 ?
[toc] | [prev] | [next] | [standalone]
| From | "Prasad, Ramit" <ramit.prasad@jpmorgan.com> |
|---|---|
| Date | 2012-11-06 23:41 +0000 |
| Message-ID | <mailman.3348.1352246819.27098.python-list@python.org> |
| In reply to | #32848 |
iMath wrote: > how to get a list of names of everything in the current directory ? http://lmgtfy.com/?q=python+get+files+in+directory ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email.
[toc] | [prev] | [next] | [standalone]
| From | emile <emile@fenx.com> |
|---|---|
| Date | 2012-11-13 10:16 -0800 |
| Message-ID | <mailman.3640.1352830625.27098.python-list@python.org> |
| In reply to | #32848 |
On 11/06/2012 03:12 PM, iMath wrote:
> how to get a list of names of everything in the current directory ?
Start by working through the tutorial to get familiar with python at
http://docs.python.org/2/tutorial/
then for your specific question, review the content at
http://www.diveintopython.net/file_handling/os_module.html
Emile
BTW, googling for "python how to get a list of names of everything in
the current directory" yields some good information as well. Google is
your friend for this level of question. Not sure anymore beyond that...
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-11-14 07:53 +1100 |
| Message-ID | <mailman.3644.1352840005.27098.python-list@python.org> |
| In reply to | #32848 |
On Wed, Nov 14, 2012 at 5:16 AM, emile <emile@fenx.com> wrote: > BTW, googling for "python how to get a list of names of everything in the > current directory" yields some good information as well. Google is your > friend for this level of question. Not sure anymore beyond that... It yields it? You mean Google is an iterator? </troll>
[toc] | [prev] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2012-11-13 21:05 +0000 |
| Message-ID | <k7ucnc$q$1@reader1.panix.com> |
| In reply to | #33263 |
In <mailman.3644.1352840005.27098.python-list@python.org> Chris Angelico <rosuav@gmail.com> writes:
> It yields it? You mean Google is an iterator?
ITYM generator.
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-11-14 08:19 +1100 |
| Message-ID | <mailman.3646.1352841557.27098.python-list@python.org> |
| In reply to | #33264 |
On Wed, Nov 14, 2012 at 8:05 AM, John Gordon <gordon@panix.com> wrote: > In <mailman.3644.1352840005.27098.python-list@python.org> Chris Angelico <rosuav@gmail.com> writes: > >> It yields it? You mean Google is an iterator? > > ITYM generator. Yeah, that thing. Troll fail. *whoops* ChrisA
[toc] | [prev] | [next] | [standalone]
| From | emile <emile@fenx.com> |
|---|---|
| Date | 2012-11-13 13:24 -0800 |
| Message-ID | <mailman.3647.1352841905.27098.python-list@python.org> |
| In reply to | #33264 |
On 11/13/2012 01:19 PM, Chris Angelico wrote: > Troll fail. > > *whoops* *sigh* mine too. Emile
[toc] | [prev] | [next] | [standalone]
| From | iMath <redstone-cold@163.com> |
|---|---|
| Date | 2012-11-06 15:12 -0800 |
| Message-ID | <mailman.3345.1352243569.27098.python-list@python.org> |
| In reply to | #32805 |
在 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 ?
[toc] | [prev] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2012-11-06 23:23 +0000 |
| Message-ID | <k7c64r$c4l$1@reader1.panix.com> |
| In reply to | #32849 |
In <mailman.3345.1352243569.27098.python-list@python.org> iMath <redstone-cold@163.com> writes:
> how to get a list of names of everything in the current directory ?
Try os.listdir() .
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web