John,
In this case I think using a class is overkill. You can write a simple
procedural version like this:
def getOption():
while True:
print """
Please choose from the following options.
1) - Normal Unit test with static data.
2) - Normal Unit test with missing
Hi!
I just wondered why you included the time.localtime(time.time()) in the
defining of today.
Doesn't the default time.gmtime() work okay?
def gettoday():
import time
today = time.strftime('%Y%m%d%H')
return today
Jacob Schmidt
> Rumor has it that Ertl, John may have mentioned thes
On Dec 22, 2004, at 22:24, Israel C. Evans wrote:
Fun!
testo = [line for line in commands.getoutput('ls -la').split('\n')]
for line in testo:
print line
spits out nicely formatted ls data.
It's Shelly!
I haven't tried it, but the above code looks like it could be
simplified to:
for line in com
On Wed, 22 Dec 2004 17:52:53 -0700, Jason Child <[EMAIL PROTECTED]> wrote:
> Ok, I guess my question (now) is:
>
> how do I change global variables within a function:
>
> ##
> VAR = "TEST"
>
> def m():
> VAR="no test"
> ##
>
>
Ok, I guess my question (now) is:
how do I change global variables within a function:
##
VAR = "TEST"
def m():
VAR="no test"
##
when I do this (from the interactive editor):
##
>>>print VAR
TEST
>>>m(
Rumor has it that Jason Child may have mentioned these words:
## I've got a silly question.
###
P1 = "prefix1"
P2 = "prefix2"
def my_func(list, items):
s = 0
out = ""
for i in range(len(list)):
if s == 0:
p = P1
s = 1
else:
sorry everyone, I figured it out on my own ;)
Jason Child wrote:
Alan Gauld wrote:
oops, I forgot to add the s = 1 and s=0 lines to the example code i
posted...
OK, To save us guessing, why don't you post it with the s=1/0 and
also the actual output pattern you get?
Seeing the error is a v
> procedural programming to object oriented. Is this a good approach
for
> such a check? It seems to me this is more work then needed.
Its a valid approach but whether its the best approach depends on
what else you intend to do. For example will there be multiple
types of greeting? or several i
Alan Gauld wrote:
oops, I forgot to add the s = 1 and s=0 lines to the example code i
posted...
OK, To save us guessing, why don't you post it with the s=1/0 and
also the actual output pattern you get?
Seeing the error is a very powerful technique for guessing what may
be
> oops, I forgot to add the s = 1 and s=0 lines to the example code i
> posted...
OK, To save us guessing, why don't you post it with the s=1/0 and
also the actual output pattern you get?
Seeing the error is a very powerful technique for guessing what may
be at fault. A second hand description
class greating:
# I think the word you are looking for is
# "greeting"
def __init__(self):
self.OK = False
self.lowValue = 1
self.highValue = 6
def opening(self):
print """
Please choose from the following options.
1) - Normal Unit test with sta
Fun!
testo = [line for line in commands.getoutput('ls -la').split('\n')]
for line in testo:
print line
spits out nicely formatted ls data.
It's Shelly!
Ertl, John wrote:
Hugo,
That looks like it will work great.
Thanks,
John
-Original Message-
From: Hugo González Monteverde [mailto
Rumor has it that Ertl, John may have mentioned these words:
Roger,
I have been doing it the Pythonic way (that is why I have no idea about how
Popen works) but I need to make sure (the systems guys called me on it) I
use the same dtg as everyone else...it is possible (has not happened yet in
20 y
Hugo,
That looks like it will work great.
Thanks,
John
-Original Message-
From: Hugo González Monteverde [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 22, 2004 12:41
To: [EMAIL PROTECTED]
Cc: Ertl, John
Subject: Re: [Tutor] Popen? or something else
You may use the 'commands' m
You may use the 'commands' module, if your subprocess should return
right away, then you can use:
##
import commands
mystring = commands.getoutput("dtg")
##
then mystring should have "2004122212" (and possibly '\n', but you'll
have to check that out, not sure about your command)in it...
Hope it
I am trying to do the usual thing of asking for an input and then checking
it to see if it is valid. If the entry is not valid then ask again until
you get the correct answer.
I have come up with this class. I am trying to make a transition from
procedural programming to object oriented. Is th
Jason Child wrote:
I've got a silly question.
###
P1 = "prefix1"
P2 = "prefix2"
def my_func(list, items):
s = 0
out = ""
for i in range(len(list)):
if s == 0:
p = P1
else:
p = P2
for j in range(len(items)):
out += p
I've got a silly question.
###
P1 = "prefix1"
P2 = "prefix2"
def my_func(list, items):
s = 0
out = ""
for i in range(len(list)):
if s == 0:
p = P1
else:
p = P2
for j in range(len(items)):
out += p +items[j]
return
Roger,
I have been doing it the Pythonic way (that is why I have no idea about how
Popen works) but I need to make sure (the systems guys called me on it) I
use the same dtg as everyone else...it is possible (has not happened yet in
20 years) it could be set to something else.
Is the example you
Rumor has it that Ertl, John may have mentioned these words:
All,
I hate to ask this but I have just installed 2.4 and I need to get some info
from a subprocess (I think that is correct term).
At the Linux command line if I input dtg I get back a string representing a
date time group. How do I do
All,
I hate to ask this but I have just installed 2.4 and I need to get some info
from a subprocess (I think that is correct term).
At the Linux command line if I input dtg I get back a string representing a
date time group. How do I do this in Python? I would think Popen but I
just don't see i
[Jacob S.]
> Hi,
> A little while ago, someone posted a message about an error and
> something about modifying the windows registry key HKEY_CURRENT_USER\Control
> Panel\Desktop so that the value Wallpaper was changed periodically. I wonder
> if anyone could tell me how to do that? I tried som
> A little while ago, someone posted a message about an error and
> something about modifying the windows registry key
HKEY_CURRENT_USER\Control
> Panel\Desktop so that the value Wallpaper was changed periodically.
I wonder
> if anyone could tell me how to do that? I tried something, and it
did
> junk = []
> for arg in sys.argv:
> junk.append(arg)
>
> junk = junk[1:]
Why not
for arg in sys.argv[1:]:
junk.append(arg)
Or even easier and faster:
junk = sys.argv[1:]
All I had time to look at, sorry.
Alan G.
___
Tutor maillist - [E
On Wed, 22 Dec 2004 11:37:57 +0900
Guillermo Fernandez Castellanos <[EMAIL PROTECTED]> wrote:
Hi Guille,
>
> I'm playing now with the Select buttons:
>
> import Tix
>
> def prtS():
> print fruits.cget('value')
>
> def prtC(val):
> print val
> print sel.cget('value')
>
> root = Ti
25 matches
Mail list logo