"Christopher Spears" <[EMAIL PROTECTED]> wrote
> I decided to post a solution to this problem that uses
> regular expressions.
>
> def my_strip(s):
>remove_leading = re.sub(r'^\s+','',s)
>remove_trailing =
> re.sub(r'\s+$','',remove_leading)
>new_s = remove_trailing
>return new_s
"Fast Primes" <[EMAIL PROTECTED]> wrote
> I am looking for ways to control multiple Windows programs
> from Python, such that I can enter data via Python and have
> that data passed to an underlying third party program's GUI
> screen, ...
> Is it possible to come at this in a more straight fo
"Christopher Spears" <[EMAIL PROTECTED]> wrote
> create a regular expression that will match a street
> address. Here is one of my attempts.
>
> Obviously, I can just create a pattern "\d+ \w+ \w+".
> However, the pattern would be useless if I had a
> street name like 3120 De la Cruz Boulevard
On 10/4/07, Kamal <[EMAIL PROTECTED]> wrote:
> Is there a method in Python which does what
> setInterval('someFunction()',5000) does in Javascript.
>
> Basically, I want to call functionOne() every x minutes, and wondering
> whats the best way to do it.
Yes, the time module in the standard library
"Rob Andrews" <[EMAIL PROTECTED]> wrote
>> Is there a method in Python which does what
>> setInterval('someFunction()',5000) does in Javascript.
>>
>> Basically, I want to call functionOne() every x minutes, and
>> wondering
>> whats the best way to do it.
>
> Yes, the time module in the standar
Alan Gauld wrote:
> If its within a GUI context then I think both Tkinter and wxPython
> have timer facilities although I've never used them.
Tkinter:
http://www.pythonware.com/library/tkinter/introduction/x9507-alarm-handlers-and-other.htm
___
Tutor ma
Kamal wrote:
> hello everyone,
>
> Is there a method in Python which does what
> setInterval('someFunction()',5000) does in Javascript.
>
> Basically, I want to call functionOne() every x minutes, and wondering
> whats the best way to do it.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recip
On 04/10/2007, Kamal <[EMAIL PROTECTED]> wrote:
> Basically, I want to call functionOne() every x minutes, and wondering
> whats the best way to do it.
If you need to run the functions concurrently, use threads. Else you
can setup a simple signal-handler for SIGALRM and set the time
accordingly:
Hi Everybody,
I'm having some problems with get an if block to work.
import re
regex=re.compile('(some expression)')
# What I'm trying to get to work
if (m=regex.search('some long string')):
print m.groups()
- The thing that isn't working is the m=regex in the if line. Is this
Tino Dai wrote:
> Hi Everybody,
>
> I'm having some problems with get an if block to work.
>
> import re
>
> regex=re.compile('(some expression)')
>
> # What I'm trying to get to work
> if (m=regex.search('some long string')):
> print m.groups()
>
> - The thing that isn't working is
Kent Johnson wrote:
> Kamal wrote:
>> hello everyone,
>>
>> Is there a method in Python which does what
>> setInterval('someFunction()',5000) does in Javascript.
>>
>> Basically, I want to call functionOne() every x minutes, and wondering
>> whats the best way to do it.
You can also look at the sc
Hi All,
lets say I am in Dir A (out of my control because I have submitted a
job to a queuing system)
and I have a python script which is running in this directory - the
one I submitted to the queue
what I need to do is have my python script run another executable,
but it must do it from a
Andre Walker-Loud wrote:
> Hi All,
>
> lets say I am in Dir A (out of my control because I have submitted a
> job to a queuing system)
>
> and I have a python script which is running in this directory - the
> one I submitted to the queue
>
> what I need to do is have my python script run ano
On Thu, Oct 04, 2007 at 03:15:41PM -0400, Andre Walker-Loud wrote:
> what I need to do is have my python script run another executable,
> but it must do it from a directory different from the one I am in, it
> needs to run in the /scratch/ directory (again not my choice)
>
> Is this possible,
Dear all-
I want to get a histogram. And I did the following.
from pylab import *
x=(1,1,2,2,2,2,3,4)
hist(x)
Then I get
(array([2, 0, 0, 4, 0, 0, 1, 0, 0, 1]), array([ 1. , 1.3, 1.6, 1.9, 2.2,
2.5, 2.8, 3.1, 3.4, 3.7]), )
But actually I want to get a picture.
What
On 04/10/2007, Fangwen Lu <[EMAIL PROTECTED]> wrote:
> What's the problem?
We have no idea. Perhaps you could give us some info of what errors
the Python-process returns. Things will be easier to help out that
way.
--
- Rikard - http://bos.hack.org/cv/
_
"Andre Walker-Loud" <[EMAIL PROTECTED]> wrote
> If I were using CSH, I could do all this very simply by having these
> lines in my script
>
> ### .csh file
>
> cd /scratch
> my_exe.csh
The best answer is to use subprocess as Kent suggested
but you can also use os.chdir(path) before using os.syste
Fangwen Lu wrote:
> Dear all-
>
> I want to get a histogram. And I did the following.
> from pylab import *
> x=(1,1,2,2,2,2,3,4)
> hist(x)
>
> Then I get
> (array([2, 0, 0, 4, 0, 0, 1, 0, 0, 1]), array([ 1. , 1.3, 1.6, 1.9,
> 2.2, 2.5, 2.8, 3.1, 3.4, 3.7]), )
>
> But actually I wan
hello all, im sorry but i might be asking a lot of Tkinter questions
for a bit.
im still working on my first GUI, it is very simple all i want it to
do is open a text file, write to it, than save it. so far i have a
GUI with the ability to right text (nothing amazing), but i don't
know how
Christopher Spears wrote:
> One of the exercises in Core Python Programming is to
> create a regular expression that will match a street
> address. Here is one of my attempts.
>
street = "1180 Bordeaux Drive"
patt = "\d+ \w+"
import re
m = re.match(patt, street)
if m is
Hello,
I am writing a little program to test a theory and as part of teaching
myself Python. I've only been at this about a week now. I have a
program that "should" work but doesn't. It generates a random number
between 1 and 2 out to 10 decimal places. I think there is something
wrong with how my
On 10/4/07, max baseman <[EMAIL PROTECTED]> wrote:
> hello all, im sorry but i might be asking a lot of Tkinter questions
> for a bit.
> im still working on my first GUI, it is very simple all i want it to
> do is open a text file, write to it, than save it. so far i have a
> GUI with the ability t
Thank you everyone for the help. I have two solutions, but I would
love one that uses the subprocess.Popen() - I have no experience with
this module.class - if someone with more experience would feel
inclined to provide an example, I would be very much appreciative.
SOLUTION 1 (my brute for
I'm no Python wizard, I'm still learning myself. But I think you need
another "if" statement to check if "guess" is equal to "number".
if guess == number:
print "Congratulations!"
Something like that.
On 10/4/07, Jim Hutchinson <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am writing a little
On Thu, 4 Oct 2007, Jim Hutchinson wrote:
> Any idea what I'm doing wrong?
> while (guess != number):
This is your problem. Like all^h^h^h most numbers in computing, floating
point numbers are stored in binary. They only approximate the decimal
values they print out as.
Two numbers can prin
On Thu, 4 Oct 2007, Jerry VanBrimmer wrote:
> I'm no Python wizard, I'm still learning myself. But I think you need
> another "if" statement to check if "guess" is equal to "number".
>
> if guess == number:
> print "Congratulations!"
No, he's got the equivalent function in his while statemen
I need to start using the reply all button...
Andrew James wrote:
> while guess != number:
>guess = float(raw_input("Make another guess: "))
>if guess > number:
>print "Lower..."
>elif guess < number:
>print "Higher..."
>tries += 1
>
> You're asking people to change
27 matches
Mail list logo