[Tutor] Dates and databases, and blobs and Python.

2005-03-26 Thread Liam Clarke
Hi, Just a quick query. I want to store dates and work with them in my SQLite database. There's no specific need for any calculations to done on one side or another (i.e. it's a single user database). I googled how to work with dates in SQL, and I got one like this - SELECT * FROM totp WHERE w

Re: [Tutor] re question

2005-03-26 Thread Kent Johnson
I don't know why this isn't working for you but this worked for me at a DOS console: >>> s='850hPa±' >>> s '850hPa\xf1' >>> import re >>> re.sub('\xf1', '*', s) '850hPa*' >>> import sys >>> sys.stdout.encoding 'cp437' and also in IDLE with a different encoding: >>> s='850hPa±' >>> s '850hPa\

Re: [Tutor] primes - sieve of odds

2005-03-26 Thread John Miller
On Mar 24, 2005, at 6:01 AM, C Smith <[EMAIL PROTECTED]> wrote: What follows is an attempt based on the previous tutor-evolved sieve that extends the range in which to find the next prime by a factor of 2 over the last known prime. A similar algorithm is on ASPN (I bellieve), under Space-efficient

Re: [Tutor] Dates and databases, and blobs and Python.

2005-03-26 Thread Sean Perry
Liam Clarke wrote: And then there's the overall question - What would be the least fiddly & least error prone way of working with dates and times? Python or SQL? Liam, SQL is another language. You need to learn it like you are learning Python. It has pretty decent support for dates and times as p

Re: [Tutor] primes - sieve of odds

2005-03-26 Thread Sean Perry
John Miller wrote: How does one actually use this module? For example: >>> import eratosthenes >>> eratosthenes.primes() >>> eratosthenes.primes().next() 2 >>> eratosthenes.primes().next() 2 >>> eratosthenes.primes().next() 2 How does one get beyond the first prime? it = eratosthenes.primes()

[Tutor] Using python to write games

2005-03-26 Thread David Holland
Is there any material anyone knows about how to use pure python without pygame to write games ? The reason for asking, is that although pygame is good it has the disadvantage of that your users must have pygame. It is also harder to create a stand alone .exe with python ? Send instant messages t

Re: [Tutor] Using python to write games

2005-03-26 Thread Kent Johnson
David Holland wrote: Is there any material anyone knows about how to use pure python without pygame to write games ? The reason for asking, is that although pygame is good it has the disadvantage of that your users must have pygame. It is also harder to create a stand alone .exe with python ? Wha

Re: [Tutor] Using python to write games

2005-03-26 Thread John Fouhy
David Holland wrote: Is there any material anyone knows about how to use pure python without pygame to write games ? The reason for asking, is that although pygame is good it has the disadvantage of that your users must have pygame. It is also harder to create a stand alone .exe with python ? Why

Re: [Tutor] a shorter way to write this

2005-03-26 Thread John Fouhy
Kent Johnson wrote: jrlen balane wrote: basically, i'm going to create a list with 96 members but with only one value: is there a shorter way to write this one??? [1] * 96 Just a note on this --- This will work fine for immutable types (such as integers or strings). But you can get into trouble i

[Tutor] Re: Dates and databases, and blobs and Python.

2005-03-26 Thread Lee Harr
Just a quick query. I want to store dates and work with them in my SQLite database. There's no specific need for any calculations to done on one side or another (i.e. it's a single user database). I googled how to work with dates in SQL, and I got one like this - SELECT * FROM totp WHERE wk BETWEEN

Re: [Tutor] Re: Dates and databases, and blobs and Python.

2005-03-26 Thread Kent Johnson
Lee Harr wrote: I have heard a lot of really good things about SQLObject: http://sqlobject.org/ However, that requires a more full-featured database, like postgresql. According to the docs SQLObject supports SQLite: http://sqlobject.org/docs/SQLObject.html#requirements Kent

[Tutor] Why cant I return more than once here?

2005-03-26 Thread gerardo arnaez
Hi all, I am working a simple function and want it return a a float a list and a dictionary But it seems that I can only use return once in the function cant see to figure out why I can return more than once? Thanks for the help! -- #!/usr/

Re: [Tutor] Why cant I return more than once here?

2005-03-26 Thread Kent Johnson
gerardo arnaez wrote: Hi all, I am working a simple function and want it return a a float a list and a dictionary But it seems that I can only use return once in the function cant see to figure out why I can return more than once? Thanks for the help! 'return' does two things - it specifies what

Re: [Tutor] Dates and databases, and blobs and Python.

2005-03-26 Thread Liam Clarke
Hi Kent, > Most databases have a DATE type and you can directly store and retrieve date > objects. Looking at the > pysqlite code I see it uses mxDateTime for date support - it doesn't use the > Python datetime module. > > So the first step is to install mxDateTime from > http://www.egenix.c

[Tutor] Re: Dates and databases, and blobs and Python.

2005-03-26 Thread Lee Harr
I have heard a lot of really good things about SQLObject: http://sqlobject.org/ However, that requires a more full-featured database, like postgresql. According to the docs SQLObject supports SQLite: http://sqlobject.org/docs/SQLObject.html#requirements Wups. I even looked at that page before post

Re: [Tutor] Defining functions

2005-03-26 Thread Jacob S.
Try this. import sys def my_raw_input(prompt): sys.stdout.write(prompt)## Since they're thinking of bonking off print as well. a = sys.stdin.readline() if a.startswith(prompt): return a[:len(prompt)] return a It leaves the '\n' on the end... so it sucks. I know there is

[Tutor] Running a python script from another python script

2005-03-26 Thread M.Sinan ORUN
Hello, I am a newbee in python and trying to make a small script for my school project . I try to run a python cgi script from another phyton script as a result of an action . What is the neccesary command for this action and is there a special class have to be imported for this command. below