On 11/12/2012 7:25 AM, Joel Goldstick wrote:
Chris gave you the same help that you got yesterday.
...
go to ://python.org> and read the tutorials,
specifically about functions.
It is hard to see what is working and not with an empty database. But to
drive the point home, running
import sqlite3
def connect():
conn = sqlite3.connect(':memory:')#use sch3.db or sch4.db .... etc.
cur = conn.cursor()
cur.execute("create table schedule (teams integer, sn integer,
badge integer ,name text, grp integer,\
major text, track text, stage text, tc text, subject text, course
text, ws text, date text, \
time text, proctor text, code text, no integer,fl_time text, flag2
text, flag3 text,\
flag4 text, clash1 integer, clash2 integer)")
return cur
cur = connect()
print(cur.fetchone())
cur.execute("select * from schedule")
print(cur.fetchall())
# prints
None
[]
So the change suggested by multiple people *does* work ;-).
On a different note: use triple quote for multi-line strings and
backslashes are not needed.
cur.execute('''create table schedule (teams integer, sn integer,
badge integer ,name text, grp integer, major text,
track text, stage text, tc text, subject text, course text,
ws text, date text, time text, proctor text, code text,
no integer,fl_time text, flag2 text, flag3 text, flag4 text,
clash1 integer, clash2 integer)''')
works fine. SQL treats newlines in statements as whitespace.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list