Re: [Tutor] This should be easy

2005-07-19 Thread Michael Dunn
I'm not sure why your first example worked: "Table" is a reserved word in SQL (i.e. it's used as a SQL command), so you shouldn't use it as a table name. Imagine a poor dumb computer trying to parse "create table table"... Cheers, Michael ___ Tutor maill

Re: [Tutor] Defining functions

2005-03-25 Thread Michael Dunn
Something I've always wondered: if input() is so dangerous, why is it there? What valid uses does it have in the wild? I ask this because this confusion comes up a lot: people expect input() to return a string and it throws them when it doesn't. We all just learn to use raw_input(), and to forget

Re: [Tutor] Defining functions

2005-03-24 Thread Michael Dunn
Hi John, when you want user input, you almost always need raw_input(), not input(). Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] stopping greedy matches

2005-03-17 Thread Michael Dunn
As Kent said, redemo.py is a script that you run (e.g. from the command line), rather than something to import into the python interpretor. On my OSX machine it's located in the directory: /Applications/MacPython-2.3/Extras/Tools/scripts Cheers, Michael ___

[Tutor] Reading Tutor with gmail: monospace fonts

2005-02-24 Thread Michael Dunn
Hi all, This is slightly off topic, but I've noticed a lot of people are using gmail accounts to post to tutor and I just wanted to share a useful trick I just learned for making gmail display and edit mail with a monospace rather than proportional font. I'm sure anyone who's tried it agrees that

Re: [Tutor] Print text position problems when using triple quotes

2005-02-24 Thread Michael Dunn
Hi Luke, > Is there a way to preserve the readability of the code and have > printed text from indented blocks, say, nested conditionals, appear > flush at left, not printed exactly where I've written them in the > script? you can use the textwrap module for this. >>> from textwrap import dedent

Re: [Tutor] How can i use both float and int?

2005-02-22 Thread Michael Dunn
Hi .,, An error will certainly occur (you should always try it and see). You could do something like: n = raw_input("Number1: ") try: number1 = int(n) except ValueError: number1 = float(n) This will make number1 an integer if possible, and a float otherwise. But (and wiser heads may correct me

Re: [Tutor] database programming

2005-02-21 Thread Michael Dunn
Hi Chris, If you just want to learn about databases, then sqlite is a good way to go. It's small, it's typeless (which means you don't have to define ahead of time what sort of thing is going to go in which bit of the database; python is typeless too), and it is not split into client and server (m