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
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
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
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
___
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
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
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
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