Hi guys.

im new in this forum, getting used to python+turbogears and already have a doubt.

i have a sql statement to do , that uses "like" . for example:

sql = db.text("select name from users where name like '%Fernando%' and dt_birthday='%s'" %(dt_birthday))

and the server gives me the following error:

TypeError: not enough arguments for format string

and didnt took long to realize that he is messing with my '%Fernando%' because he uses % to format the string ( %s).

There is anyway to fix that? workaround? i really need to use it. any tip or help will be well acepted !! thanks in advance !!!

7 Years
Discussion Span
Last Post by fferrandini

i found a workaround for it.. or the solution itself? dont now...

thats what i did, for example:
sql = "select name from user where date_birthday = '%s' " %(dt_birth)
sql += " and name like '%%Fernando%%' "
rs = db.execute(db.text(sql)).fetchall()

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.