On Monday, September 5, 2016 at 4:34:45 PM UTC+1, Rustom Mody wrote:
> So what do you get when you replace the if-else with a simple: print(file) ?
>
> [And BTW dont use the variable name “file” its um sacred]
Only in Python 2, it's gone from the built-ins in Python 3
https://docs.python.org/3/
On Tue, Sep 6, 2016 at 2:29 AM, Smith wrote:
>> What exactly are you expecting the 'break' to do here? Can you explain
>> to me the intent of your code?
>>
>> ChrisA
>>
> I'd like to create a script that searches the directory .py files.
> If the script does not find the file extension .py would r
What exactly are you expecting the 'break' to do here? Can you explain
to me the intent of your code?
ChrisA
I'd like to create a script that searches the directory .py files.
If the script does not find the file extension .py would return the
error message "File Not Found".
--
https://mai
On 05/09/2016 17:57, jmp wrote:
Is that what you're expecting ?
A slightly different version:
import glob, os
a = input("search for files with the extension .py into directory: ")
print glob.glob(os.path.join(a, '*.py'))
jm
Thank you
Sorry, but i'm newbie :-(
--
https://mail.python.org/ma
On 09/05/2016 05:41 PM, Smith wrote:
Il 05/09/2016 17:34, Rustom Mody ha scritto:
So what do you get when you replace the if-else with a simple:
print(file)
a = input("search for files with the extension .py into directory: ")
for file in os.listdir(a):
if file.endswith(".py"):
Il 05/09/2016 17:34, Rustom Mody ha scritto:
So what do you get when you replace the if-else with a simple: print(file)
a = input("search for files with the extension .py into directory: ")
for file in os.listdir(a):
if file.endswith(".py"):
print(file)
search for fil
On Tue, Sep 6, 2016 at 1:27 AM, Smith wrote:
> Hello to all,
> I wanted to know because even though the files are present on the directory
> I write input gives me "file not found".
> You can help me?
> Thank you
>
> a = input("Digita la directory dove vuoi trovare i file py: ")
> for file in os.
On Tue, Sep 6, 2016 at 1:34 AM, Rustom Mody wrote:
> [And BTW dont use the variable name “file” its um sacred]
Nah, that part's fine. Python isn't religious about builtins.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
So what do you get when you replace the if-else with a simple: print(file) ?
[And BTW dont use the variable name “file” its um sacred]
--
https://mail.python.org/mailman/listinfo/python-list
On 09/05/2016 05:27 PM, Smith wrote:
Hello to all,
I wanted to know because even though the files are present on the
directory I write input gives me "file not found".
You can help me?
Thank you
a = input("Digita la directory dove vuoi trovare i file py: ")
for file in os.listdir(a):
if fi
Il 05/09/2016 17:27, Smith ha scritto:
Hello to all,
I wanted to know because even though the files are present on the
directory I write input gives me "file not found".
You can help me?
Thank you
a = input("Digita la directory dove vuoi trovare i file py: ")
for file in os.listdir(a):
if f
FYI: the '/*.*' is part of the error message returned.
-Original Message-
From: ch...@rebertia.com [mailto:ch...@rebertia.com] On Behalf Of Chris
Rebert
Sent: Wednesday, January 07, 2009 6:40 PM
To: Per Olav Kroka
Cc: python-list@python.org
Subject: Re: listdir reports [Error
> PS: Why does the listdir() function add '*.*' to the path?
Don't know what you're talking about. It doesn't do any globbing or
add "*.*" to the path. Its exclusive purpose is to list the contents
of a directory, so /in a sense/ it does add "*.*", but then not adding
"*.*" would make the function
On Dec 14, 2:00 pm, "Vladimir Rusinov" <[EMAIL PROTECTED]>
wrote:
>Is there any easy way to list files using bash-like patterns? Something like
>listfiles("/var/log/*.log"), listfiles("/var/{cache,run}/*").
> On 12/14/07, Jeff McNeil <[EMAIL PROTECTED]> wrote:
>
>
>
> > Sure is.. check out the glob
On 12/14/07, Jeff McNeil <[EMAIL PROTECTED]> wrote:
>
> Sure is.. check out the glob module:
> http://www.python.org/doc/current/lib/module-glob.html (Official)
> http://blog.doughellmann.com/2007/07/pymotw-glob.html (PyMOTW)
>
Thanks a lot!
--
Vladimir Rusinov
GreenMice Solutions: IT-решения на
On Dec 14, 1:56 am, "Vladimir Rusinov" <[EMAIL PROTECTED]>
wrote:
glob or fnmatch
http://docs.python.org/lib/module-glob.html
rd
--
http://mail.python.org/mailman/listinfo/python-list
Sure is.. check out the glob module:
http://www.python.org/doc/current/lib/module-glob.html (Official)
http://blog.doughellmann.com/2007/07/pymotw-glob.html (PyMOTW)
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "cre
You can use win32file.FindFilesIterator to loop thru the files
without creating a huge list of everthing in the folder.
hth
Roger
"Peter A. Schott" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>I want to build a program that does some archiving. We have several pr
Peter A. Schott wrote:
> I want to build a program that does some archiving. We have several programs
> that have been dumping files into a folder (one folder) for some time now. I
> want to limit the number of files returned by listdir to avoid trying to
> build a
> list with tons of entries.
Peter A. Schott <[EMAIL PROTECTED]> writes:
> Is there any way to build a list of the first 1000 files or so in a folder?
The obvious way is
first_1000 = os.listdir()[:1000]
That does build a potentially bigger list in memory before chopping
off the 1000 elements, but unless you're running ou
20 matches
Mail list logo