Re: [Tutor] Alarm Clock (suggestions please)

2009-02-02 Thread John Fouhy
2009/2/3 David : > while(doit): >mytime = list(time.localtime()) >hour = mytime[3] >minute = mytime[4] >if hour == alarmhour and minute == alarmmin: >subprocess.call('mplayer -loop 9 ring.wav', shell=True) >sys.exit() Hi David, What

[Tutor] Alarm Clock (suggestions please)

2009-02-02 Thread David
Hi All, As I am getting a little older, I sometimes take small naps to recharge my batteries:) Is this while loop OK? What kind of error checking should I use? thanks -david #!/usr/bin/python import time import subprocess import sys doit = 1 alarmhour = int(raw_input("Please enter the hour

Re: [Tutor] regex: not start with FOO

2009-02-02 Thread Bernard Rankin
> > I'd like to match any line that does not start with FOO. (Using just a > > reg-ex > rule) > > > > 1) What is the effective difference between: > > > > (?!^FOO).* > > > > ^(?!FOO).* > > > > 2) Is there a better way to do this? > > > > myline = 'FOO things in line' > > >>> myline.startswi

[Tutor] newton's square root formula

2009-02-02 Thread WM.
# program to find square root square = float(raw_input ("Please enter a number to be rooted, ")) guess = input("Please guess at the root, ") i = 0 while guess**2 != square: i+=1 # Newton's formula guess = guess - (guess * guess - square) / (guess * 2) print i print

Re: [Tutor] Installing python via ftp in virtual domain

2009-02-02 Thread John Fouhy
2009/2/3 Tim Johnson : >> - wrong libraries > how do we resolve paths to libraries? Well, like I suggested, you could try building a staticly-linked version. Then it doesn't matter. Otherwise, I'm not sure. Maybe you could figure out what libraries you need, upload them, and play around with

Re: [Tutor] Installing python via ftp in virtual domain

2009-02-02 Thread Tim Johnson
On Monday 02 February 2009, John Fouhy wrote: > 2009/2/3 Tim Johnson : > > I have a client who is hosting under virtual domain services that do not > > provide python. > > He has unlimited disk space available ( or so the hoster says) and they > > would allow installation of binaries in the virtual

Re: [Tutor] newton's sqrt formula

2009-02-02 Thread Kent Johnson
On Mon, Feb 2, 2009 at 6:50 PM, WM. wrote: ># Newton's formula >newguess = guess - (guess * guess - square) / (guess * 2) >guess = newguess or guess = (guess + square/guess)/2 Kent ___ Tutor maillist - Tutor@python.org http:/

Re: [Tutor] Installing python via ftp in virtual domain

2009-02-02 Thread John Fouhy
2009/2/3 Tim Johnson : > I have a client who is hosting under virtual domain services that do not > provide python. > He has unlimited disk space available ( or so the hoster says) and they > would allow installation of binaries in the virtual domain via ftp. > > It's a linux 'box' with a /private

[Tutor] Installing python via ftp in virtual domain

2009-02-02 Thread Tim Johnson
I have a client who is hosting under virtual domain services that do not provide python. He has unlimited disk space available ( or so the hoster says) and they would allow installation of binaries in the virtual domain via ftp. It's a linux 'box' with a /private folder under the domain root. giv

Re: [Tutor] regex: not start with FOO

2009-02-02 Thread Jervis Whitley
On Tue, Feb 3, 2009 at 9:46 AM, Bernard Rankin wrote: > Hello, > > > I'd like to match any line that does not start with FOO. (Using just a > reg-ex rule) > > 1) What is the effective difference between: > > (?!^FOO).* > > ^(?!FOO).* > > 2) Is there a better way to do this? > myline = 'FOO thin

Re: [Tutor] newton's sqrt formula

2009-02-02 Thread Alan Gauld
"WM." wrote square = input ('Please enter a number to be rooted, ') square = square * 1.0 Use raw_input() instead of input() and don't multiply by 1.0 - instead convert to float using float(): square = float( raw_input ('Please enter a number to be rooted, ')) guess = input('Please guess a

[Tutor] newton's sqrt formula

2009-02-02 Thread WM.
# program to find square root square = input ('Please enter a number to be rooted, ') square = square * 1.0 guess = input('Please guess at the root, ') guess = guess * 1.0 newguess = 0. while guess**2 != square: # Newton's formula newguess = guess - (guess * guess - square) / (gue

[Tutor] regex: not start with FOO

2009-02-02 Thread Bernard Rankin
Hello, I'd like to match any line that does not start with FOO. (Using just a reg-ex rule) 1) What is the effective difference between: (?!^FOO).* ^(?!FOO).* 2) Is there a better way to do this? Thanks, :) ___ Tutor maillist - Tutor

[Tutor] question about mpmath product expression

2009-02-02 Thread Bernd Prager
Does anybody know if there is a precision difference when I use mpmath and take an expression: from mpmath import * mp.dps = 100 mu0 = [mpf('4') * pi * power(10, -7) rather then: mu0 = fprod([mpf('4'), pi, power(10, -7)]) ? Thanks, -- Bernd ___ Tutor

Re: [Tutor] reading binary files

2009-02-02 Thread Alan Gauld
wrote> I am trying to read data from a file that has format item_name num_items item_type items eg TIME 1 0.0 DISTANCE 10 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 Where is the item_type? I can read this if the data are in ASCII format using in_file = open("my_file.dat",

Re: [Tutor] reading binary files

2009-02-02 Thread jadrifter
On Mon, 2009-02-02 at 11:31 +, etrade.griffi...@dsl.pipex.com wrote: > Hi > > I am trying to read data from a file that has format > > item_name num_items item_type items > > eg > > TIME 1 0.0 > DISTANCE 10 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 > TIME 1 1.0 > DISTANCE

[Tutor] reading binary files

2009-02-02 Thread etrade . griffiths
Hi I am trying to read data from a file that has format item_name num_items item_type items eg TIME 1 0.0 DISTANCE 10 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 TIME 1 1.0 DISTANCE 10 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 I can read this if the data are in ASCII format us