hlubenow wrote:
>
> enquiring mind wrote:
>
> > Running 2.4.1 Python (learning)
> > Running SUSE Linux 10
> >
> > At Chapter 5 is where the Pygame module is
> > introduced so I have a little time before I have to figure out what I
> > have to download and install.
>
> Are you asking for advice h
I want to script the benchmarking of some compression algorithms on a
Windows box. The algorithms are all embodied in command line
executables, such as gzip and bzip2. I would like to measure three things:
1. size of compressed file
2. elapsed time (clock or preferably CPU)
3. memory used
The f
Getting the pid:
http://timgolden.me.uk/python/wmi_cookbook.html
List all running processes
import wmi
c = wmi.WMI ()
for process in c.Win32_Process ():
print process.ProcessId, process.Name
List all running notepad processes
import wmi
c = wmi.WMI ()
for process in c.Win32_Process (name=
You posting in the wrong group, I'm sure to don't give a rats ass and that's
why no one will ever, in your life, take you seriously. I have my own
feelings on President Bush but I spend the time to get the facts (months and
sometimes years) and find a publisher. Get an education, quit shouting a
Hi folks,
in a program I'm writing I have several commands I pass to the unix OS
underneath the code.
I want to perform error checking to make sure that the OS commands'
exit gracefully, but I'm not seeing a simple python module to do this.
The closest I can see is system(), as detailed here:
htt
7stud <[EMAIL PROTECTED]> wrote:
...
> I'm using python 2.3.5.
>
> On Mar 29, 9:34 am, [EMAIL PROTECTED] (Alex Martelli) wrote:
> > Simplest way:
> >
> > class smethod(object):
> > def __init__(self, f): self.f=f
> > def __call__(self, *a, **k): return self.f(*a, **k)
> >
> > Alex
>
> Inte
Both methods work well, thank you!
--
http://mail.python.org/mailman/listinfo/python-list
str != ""
returns true if str is NOT the empty string.
str is not None
returns true if str is null (or None as it's called in python).
To check to make sure a string is nonnull and nonempty, do:
str is not None and str != ""
--
http://mail.python.org/mailman/listinfo/python-list
oscartheduck wrote:
> in a program I'm writing I have several commands I pass to the unix OS
> underneath the code.
>
> I want to perform error checking to make sure that the OS commands'
> exit gracefully, but I'm not seeing a simple python module to do this.
If you're using Python 2.5, you can
My code is:
-a.py-
import b
class A:
def __init__(self):
pass
def my_method(self):
var = 1
self.var = 2
b.set_var(self)
print var
print self.var
my_a = A()
my_a.my_method()
-b.py-
def set_var(self):
var = 2
self.var
asdf1234234 wrote:
> -a.py-
> import b
>
> class A:
> def __init__(self):
> pass
> def my_method(self):
> var = 1
> self.var = 2
> b.set_var(self)
> print var
> print self.var
>
> my_a = A()
> my_a.my_method()
>
> -b.py-
> de
On Apr 1, 9:43 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
> asdf1234234 wrote:
> > -a.py-
> > import b
>
> > class A:
> > def __init__(self):
> > pass
> > def my_method(self):
> > var = 1
> > self.var = 2
> > b.set_var(self)
> > print
Rehceb Rotkiv escreveu:
> Hello everyone,
>
> can I sort a multidimensional array in Python by multiple sort keys? A
> litte code sample would be nice!
class MyList(list):
# This is the index of the element to be compared
CmpIndex=0
# Comparision methods
@staticm
On 2007-04-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> how can i compare a string which is non null and empty?
[...]
> In java,I do this:
> if (str != null) && (!str.equals(""))
>
> how can i do that in python?
If you want to litterally do that, it's
if (str != None) and (str != ""
On Apr 2, 1:59 am, Duncan Smith <[EMAIL PROTECTED]> wrote:
> Hello,
> I am currently implementing (mainly in Python) 'models' that come
> to me as Excel spreadsheets, with little additional information. I am
> expected to use these models in a web application. Some contain many
> worksheets
It is probably worth noting that the example is not executable code:
str() is a function.
[EMAIL PROTECTED]:~$ python
Python 2.4.4c0 (#2, Jul 30 2006, 15:43:58)
[GCC 4.1.2 20060715 (prerelease) (Debian 4.1.1-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>
On Apr 1, 7:56 pm, "wswilson" <[EMAIL PROTECTED]> wrote:
> On Apr 1, 9:43 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
>
>
>
> > asdf1234234 wrote:
> > > -a.py-
> > > import b
>
> > > class A:
> > > def __init__(self):
> > > pass
> > > def my_method(self):
> > > var
On 2007-04-02, Shane Geiger <[EMAIL PROTECTED]> wrote:
>>> how can i compare a string which is non null and empty?
>>>
>> [...]
>>
>>> In java,I do this:
>>> if (str != null) && (!str.equals(""))
>>>
>>> how can i do that in python?
>>
>> If you want to litterally do that, it's
>>
>>
On Apr 1, 7:56 pm, "wswilson" <[EMAIL PROTECTED]> wrote:
> On Apr 1, 9:43 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
>
>
>
> > asdf1234234 wrote:
> > > -a.py-
> > > import b
>
> > > class A:
> > > def __init__(self):
> > > pass
> > > def my_method(self):
> > > var
I am working on a Outlook COM project. For some reason
win32com.client.constants
quit working between runs of one of my test scripts. It's supposed to
acquire attributes for all constants defined in loaded COM servers
through its __dicts__ attribute,and did for awhile
Now it is throwing an At
On Apr 1, 7:43 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
> asdf1234234 wrote:
> > -a.py-
> > import b
>
> > class A:
> > def __init__(self):
> > pass
> > def my_method(self):
> > var = 1
> > self.var = 2
> > b.set_var(self)
> > print
On Apr 1, 9:24 pm, "7stud" <[EMAIL PROTECTED]> wrote:
> On Apr 1, 7:43 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
>
>
>
> > asdf1234234 wrote:
> > > -a.py-
> > > import b
>
> > > class A:
> > > def __init__(self):
> > > pass
> > > def my_method(self):
> > > var = 1
John Machin wrote:
> On Apr 2, 1:59 am, Duncan Smith <[EMAIL PROTECTED]> wrote:
>
>>Hello,
>> I am currently implementing (mainly in Python) 'models' that come
>>to me as Excel spreadsheets, with little additional information. I am
>>expected to use these models in a web application. Some co
On Apr 1, 7:56 pm, "wswilson" <[EMAIL PROTECTED]> wrote:
> I am parsing a document which contains some lines with code I want to
> eval or exec. However, due to the complexity of the parsing, I am
> splitting it among different methods. So, if I eval something in one
> method, it won't be there if
On Apr 2, 2:52 am, "ken" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i have the following code to load a url.
> My question is what if I try to load an invalide url
> ("http://www.heise.de/";), will I get an IOException? or it will wait
> forever?
>
Depends on why the URL is invalid. If the URL refers t
python unzip
At first, I tried to use 'os.popen3("unzip ...") like this:
fin, fout, ferr = os.popen3("unzip -o -d %s %s" % (dest, zipfile))
strerr = ferr.read()
# This makes the program hanging up
if strerr:
print >> sys.stderr, strerr
outlog.error(strerr)
I want to know is this caused by
asdf1234234 <[EMAIL PROTECTED]> wrote:
> My code is:
> -a.py-
> import b
>
> class A:
> def __init__(self):
> pass
Incidentally, these last two lines are totally, utterly useless. Do NOT
define special methods like this -- just omit the whole def statement
and you'll have identic
Thomas Krüger <[EMAIL PROTECTED]> wrote:
> Rehceb Rotkiv schrieb:
> > can I sort a multidimensional array in Python by multiple sort keys? A
> > litte code sample would be nice!
>
> You can pass a function as argument to the sort method of a list.
> The function should take two arguments and retu
I am accustomed to vi my pthon scripts with 'tab' indent. But when I
copy some code to my script, the indent may be 'spaces'. So I wanna a
way to substitute those 'spaces' to be 'tabs' conveniently.
For example, I:
expand -t4 test.py >/tmp/test2.py
vi /tmp/test2.py
Then in vim, the indents should
"Bryan Olson" <[EMAIL PROTECTED]> wrote:
> Steve Holden wrote:
> > Hendrik van Rooyen wrote:
> >> Are sockets full duplex?
> >>
> > Yes. But you have to use non-blocking calls in your application to use
> > them as full-duplex in your code.
>
> Hmmm... I'm missing something. Suppose I have one
Alex Martelli schrieb:
> Thomas Krüger <[EMAIL PROTECTED]> wrote:
>> def sorter(a, b):
>> return cmp(a.id, b.id)
>>
>> obj_lst.sort(sorter)
>
> A MUCH better way to obtain exactly the same semantics would be:
>
> def getid(a):
> return a.id
>
> obj_list.sort(key=getid)
Frankly speaking
On Apr 1, 4:59 pm, Duncan Smith <[EMAIL PROTECTED]> wrote:
> Hello,
> I am currently implementing (mainly in Python) 'models' that come
> to me as Excel spreadsheets, with little additional information. I am
> expected to use these models in a web application. Some contain many
> worksheets
> You still dream of this, isn't it? Type inference in dynamic languages
> doesn't scale. It didn't scale in twenty years of research on
> SmallTalk and it doesn't in Python. However there is no no-go theorem
type inference sure is difficult business, and I won't deny there are
scalability issues
101 - 133 of 133 matches
Mail list logo