[Tutor] weird error messge

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Nov 4 19:51:08 EST 2003

Hi Conrad,

Looking back at an older post:

On Sun, 2 Nov 2003, Conrad Koziol wrote:

> 	cursor.execute('''select names, dates, subjects, posts, positions from
> %s where threads = \'%s\' and positions > \'%s\' and positions <
> \'%s\'''' % (forum, thread, start_post, end_post))
> 	postsinfo = cursor.fetchall()

[some text cut]

> 	for post in postsinfo:
> 		posts = re.sub('<!--***INSERT NAME HERE***-->', post[1], posts)
> 		posts = re.sub('<!--***INSERT DATE HERE***-->', post[2], posts)
> 		posts = re.sub('<!--***INSERT SUBJECT HERE***-->', post[3], posts)
> 		posts = re.sub('<!--***INSERT POST HERE***-->', post[4], posts)

Warning: Python's lists are indexed starting at 0, not 1.  So you may need
to change this to refer to 'post[0]', 'post[1]', 'post[2]', and 'post[3]'.

Hope this helps!

More information about the Tutor mailing list