On 15May2014 15:34, Benjamin Schollnick wrote:
I am going to be using this code as part of a web system, and I would love
any feedback, comments and criticism. [...]
I am using scandir from benhoyt to speed up the directory listings, and
data collection. [...]
I had considered using OrderedDicts
On Fri, May 16, 2014 at 5:34 AM, Benjamin Schollnick
wrote:
> Just as a side note, I'm not completely PEP 8. I know that, I use a
> slightly laxer setting in pylint, but I'm working my way up to it...
>
> I am using scandir from benhoyt to speed up the directory listings, and data
> collection.
On Mon, Sep 23, 2013 at 11:14 AM, wrote:
> Was hoping to get some tips or advice on scripting a program that would sort
> through my many links on my directory website and print out to me the ones
> that are broken or no longer functioning so that I could fix or remove them
> from the site. An
On Sunday, September 22, 2013 9:59:14 PM UTC-4, Dave Angel wrote:
> On 22/9/2013 21:14, worthingtonclin...@gmail.com wrote:
>
>
>
> > Was hoping to get some tips or advice on scripting a program that would
> > sort through my many links on my directory website and print out to me the
> > ones
On Sunday, September 22, 2013 9:36:25 PM UTC-4, Joel Goldstick wrote:
> On Sun, Sep 22, 2013 at 9:14 PM, wrote:
>
> Was hoping to get some tips or advice on scripting a program that would sort
> through my many links on my directory website and print out to me the ones
> that are broken or no
On 22/9/2013 21:14, worthingtonclin...@gmail.com wrote:
> Was hoping to get some tips or advice on scripting a program that would sort
> through my many links on my directory website and print out to me the ones
> that are broken or no longer functioning so that I could fix or remove them
> fro
On Sun, Sep 22, 2013 at 9:14 PM, wrote:
> Was hoping to get some tips or advice on scripting a program that would
> sort through my many links on my directory website and print out to me the
> ones that are broken or no longer functioning so that I could fix or remove
> them from the site. Any he
On Mon, 16 Nov 2009 14:19:16 -0800, hong zhang wrote:
>> print >>f, mcs
>
> This assigns decimal value, how can I assign Hex here to mcs?
print >>f, "%x" % mcs
--
http://mail.python.org/mailman/listinfo/python-list
--- On Mon, 11/16/09, Jeff McNeil wrote:
> From: Jeff McNeil
> Subject: Re: directory wildcard
> To: python-list@python.org
> Date: Monday, November 16, 2009, 3:01 PM
> On Nov 16, 3:33 pm, hong zhang
>
> wrote:
> > List,
> >
> > I try to assign val
I try to assign value to force_mcs sitting in a wildcard
subdirectory /sys/kernel/debug/ieee80211/phy*, but python does
not work for that such as:
os.system("echo %i >
/sys/kernel/debug/ieee80211/phy*/iwlagn/data/force_mcs" % mcs)
Any right way to do it?
I'm not sure your code works if there's
On Nov 16, 3:33 pm, hong zhang wrote:
> List,
>
> I try to assign value to force_mcs sitting in a wildcard subdirectory
> /sys/kernel/debug/ieee80211/phy*, but python does not work for that such as:
>
> os.system("echo %i > /sys/kernel/debug/ieee80211/phy*/iwlagn/data/force_mcs"
> % mcs)
>
> Any
hong zhang schrieb:
List,
I try to assign value to force_mcs sitting in a wildcard subdirectory
/sys/kernel/debug/ieee80211/phy*, but python does not work for that such as:
os.system("echo %i > /sys/kernel/debug/ieee80211/phy*/iwlagn/data/force_mcs" %
mcs)
Any right way to do it?
Don't use
On Feb 18, 8:15 am, Steve Holden wrote:
> gtillmon wrote:
> > Hello. I am new to the Python language.
> > I would like to know how to display and store the path of each mondule
> > that is called.
>
> Modules are imported, not called.
>
> > Similar to the old READY TRACE in COBOL of long ago.
>
>
On Feb 18, 3:39 pm, "Gabriel Genellina"
wrote:
> En Wed, 18 Feb 2009 12:15:25 -0200, Steve Holden
> escribió:
>
> > gtillmon wrote:
> >> I would like to know how to display and store the path of each mondule
> >> that is called.
> > It's certainly possible to trace function calls, if that would
En Wed, 18 Feb 2009 12:15:25 -0200, Steve Holden
escribió:
gtillmon wrote:
I would like to know how to display and store the path of each mondule
that is called.
It's certainly possible to trace function calls, if that would help.
sys.settrace allows you to establish a function that gets ca
gtillmon wrote:
> Hello. I am new to the Python language.
> I would like to know how to display and store the path of each mondule
> that is called.
Modules are imported, not called.
> Similar to the old READY TRACE in COBOL of long ago.
>
It's certainly possible to trace function calls, if tha
srinivasan srinivas wrote:
Can someone tell me is there any module available to create directories??
I tried os, tempfile.
I was facing some issues with os.mkdir(). The mode setting was not proper with
this method.
I created the directory 'stdin' with '0700' mode using os.mkdir() method.
$>
Rohan wrote:
> I would like to get a list of sub directories in a directory.
> If I use os.listdir i get a list of directories and files in that .
> i only want the list of directories in a directory and not the files
> in it.
> anyone has an idea regarding this.
>
import os
listofdirs=[d for d i
Rohan wrote:
> I would like to get a list of sub directories in a directory.
> If I use os.listdir i get a list of directories and files in that .
> i only want the list of directories in a directory and not the files
> in it.
> anyone has an idea regarding this.
How far down do you want to go?
A
On 30 Lip, 23:43, Rohan <[EMAIL PROTECTED]> wrote:
> I would like to get a list of sub directories in a directory.
> If I use os.listdir i get a list of directories and files in that .
> i only want the list of directories in a directory and not the files
> in it.
> anyone has an idea regarding thi
Rohan wrote:
> I would like to get a list of sub directories in a directory.
> If I use os.listdir i get a list of directories and files in that .
> i only want the list of directories in a directory and not the files
> in it.
> anyone has an idea regarding this.
>
Look up os.walk (allows you to
Sion Arrowsmith wrote:
> I have a module which needs to know what directory it's in, and to
> refer to files in a sibling directory, something like App/src/foo.py
> wants to read App/data/conf.xml . But I have no idea in what context
> foo.py is going to be run -- it could be being run as a script
thanks a lot!
On 11/11/05, Michael Konrad <[EMAIL PROTECTED]> wrote:
>
> This is what I decided on for a solution. I haven't tested it
> cross-platform yet.
>
> import os
>
> def dirListing(directory='/Users/mkonrad'):
>"""Returns a list of directories."""
>#variabl
Shi Mu:
Before all you were doing was defining a function with:
import os
def buildList( directory='c:\TEMP' ):
dirs = [ ]
listing = os.listdir(directory)
for x in listing:
x = os.path.join(directory, x)
print x
if os.path.isdir(x):
dirs.append(x)
Sorry about that, I guess send was working.
Michael Konrad wrote:
>
> This is what I decided on for a solution. I haven't tested it
> cross-platform yet.
>
> import os
>
> def dirListing(directory='/Users/mkonrad'):
> """Returns a list of directories."""
> #variables
> d
This is what I decided on for a solution. I haven't tested it
cross-platform yet.
import os
def dirListing(directory='/Users/mkonrad'):
"""Returns a list of directories."""
#variables
dirs = [] #list of directories
This is what I decided on for a solution. I haven't tested it
cross-platform yet.
import os
def dirListing(directory='/Users/mkonrad'):
"""Returns a list of directories."""
#variables
dirs = [] #list of directories
Shi Mu wrote:
> On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>>Shi Mu wrote:
>>>def buildList( directory='c:\TEMP' ):
>>>dirs = [ ]
>>>listing = os.listdir(directory)
>>>for x in listing:
>>>x = os.path.join(directory, x)
>>>print x
>>>if os.path.isdir(x
"Shi Mu" wrote:
> print buildList() gets lots of stuffs from my temp directory(there do
> exist lots of files).
> But why "print x' has nothing?
C:\>more script.py
import os
def buildList( directory='c:\TEMP' ):
dirs = [ ]
listing = os.listdir(directory)
for x in listing:
x =
On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> "Shi Mu" wrote:
>
> > but i am curious why the line of "print x" does not show
> > anything.
>
> because your c:\temp directory is empty ?
>
>
print buildList() gets lots of stuffs from my temp directory(there do
exist lots of files).
But why
"Shi Mu" wrote:
> but i am curious why the line of "print x" does not show
> anything.
because your c:\temp directory is empty ?
--
http://mail.python.org/mailman/listinfo/python-list
On 11/11/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Shi Mu wrote:
>
> > I tried this and no error reported but nothing appear on the console, why?
> >
> > import os
> >
> > def buildList( directory='c:\TEMP' ):
> > dirs = [ ]
> > listing = os.listdir(directory)
> > for x in listing:
Shi Mu wrote:
> I tried this and no error reported but nothing appear on the console, why?
>
> import os
>
> def buildList( directory='c:\TEMP' ):
> dirs = [ ]
> listing = os.listdir(directory)
> for x in listing:
> x = os.path.join(directory, x)
> print x
> if
On 11 Nov 2005 22:00:04 GMT, Michael Konrad <[EMAIL PROTECTED]> wrote:
> Richard Townsend <[EMAIL PROTECTED]> wrote:
>
> > On 11 Nov 2005 21:20:33 GMT, SU News Server wrote:
> >
> > Try passing the full pathname of each item to os.path.isdir()
> >
> > You can create the pathname using os.path.join(
Michael Konrad wrote:
> > for x in listing:
> > print x
> > if os.path.isdir(x):
> > dirs.append(x)
> >
>
> Did that and I was just getting a bunch of [ ].
if you printed "x" (the filename), that doesn't sound very likely.
maybe you printed some other variable? (l
On 11 Nov 2005 22:00:04 GMT, Michael Konrad wrote:
> Richard Townsend <[EMAIL PROTECTED]> wrote:
>
>> On 11 Nov 2005 21:20:33 GMT, SU News Server wrote:
>>
>> Try passing the full pathname of each item to os.path.isdir()
>>
>> You can create the pathname using os.path.join(directory, x)
>>
>>
Richard Townsend <[EMAIL PROTECTED]> wrote:
> On 11 Nov 2005 21:20:33 GMT, SU News Server wrote:
>
> Try passing the full pathname of each item to os.path.isdir()
>
> You can create the pathname using os.path.join(directory, x)
>
>
>
I wonder if I can join ./, so I don't have the full path
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> "SU News Server" <[EMAIL PROTECTED]> wrote:
>
>> I've struggled with this for quite a while and I'm am just not sure
>> what is going on. I have the following code
>> import os
>>
>> def buildList( directory='/Users/mkonrad' )
>>
>> dirs = [ ]
>>
>> l
On 11 Nov 2005 21:20:33 GMT, SU News Server wrote:
Try passing the full pathname of each item to os.path.isdir()
You can create the pathname using os.path.join(directory, x)
--
Richard
--
http://mail.python.org/mailman/listinfo/python-list
"SU News Server" <[EMAIL PROTECTED]> wrote:
> I've struggled with this for quite a while and I'm am just not sure
> what is going on. I have the following code
> import os
>
> def buildList( directory='/Users/mkonrad' )
>
> dirs = [ ]
>
> listing = os.listdir(directory)
>
> for x in listing:
>
Florian Lindner wrote:
> Hello,
> IIRC there is a directory traverser for walking recursively through
> subdirectories in the standard library. But I can't remember the name and
> was unable to find in the docs.
Where did you look? How did you look?
> Anyone can point me to it?
Did you try Googl
In <[EMAIL PROTECTED]>, custard_pie
wrote:
> Here's my code
>
> filelist={}
> def listFiles(self, dirName, filesInDir):
> for fname in filesInDir:
> if os.path.isfile(fname):
`fname` contains just the file name without t
Here's my code
filelist={}
def listFiles(self, dirName, filesInDir):
for fname in filesInDir:
if os.path.isfile(fname):
key = os.path.join(dirName, fname)
stats = os.stat
custard_pie wrote:
Hi,..I tried to list files in a tree directory using os.path.walk. To
avoid dirnames fromm being listed i use the os.path.isdir method.
However, when isdir encounters directories that use spaces in their
name e.q My Documents it doesn;t recognize them as directories.. Is
there an
Russell E. Owen wrote:
> It seems that the path was to a "fat" file partition and included a
> directory name that was all uppercase. The directory was created, but
> using lowercase. I'm not yet sure the version of python.
>
> The workaround for now is to not use fat file partitions. But I was
On Thu, Jan 13, 2005 at 12:07:04PM -0800, Russell E. Owen wrote:
> I stumbled across a really strange bug involving directories on linux.
>
> os.path.exists(path) can return 0 even after os.path.mkdir(path)
> succeeds (well after; this isn't a timing issue).
>
> For the first file, the directory
Python is at the whim of the services the OS provides. Maybe you should
ask in a linux-related newsgroup or mailing list, they might know more
about the specifics of both detecting and working around "weird"
filesystems like "fat".
To find the type of a filesystem, Linux provides the statfs(2) fu
On Thu, 09 Dec 2004 07:42:57 -0800, Scott David Daniels
<[EMAIL PROTECTED]> wrote:
>Look into the two-argument form of the write command:
Well, I should have guessed that, it works. Thanks!
> import zipfile
> archive = zipfile.ZipFile('box.zip', 'w', zipfile.ZIP_DEFLATED)
> archive.
Bulba! wrote:
tried to read file, zip it, and put in the target directory
It works nice, except the zipfile created contains the directory path
of the source file -- which I do NOT want to recreate.
Look into the two-argument form of the write command:
import zipfile
archive = zipfile
49 matches
Mail list logo