<p>我有一个小的decorator函数,在这个函数中,我将在一个表中找到未知数量的条目:</p>
<pre><code>def Deco(func):
func
conn = sqlite3.connect('/home/User/vocab_database/vocab.db')
with conn:
cur = conn.cursor()
cur.execute("SELECT name FROM sqlite_master WHERE type='table'")
total = cur.fetchall()
print "You have %d tables " % len(total)
## this line below, is where I wanted to use a formatted string ##
cur.execute("SELECT * FROM %s") % total[0]
entries = cur.fetchall()
print "You have %d entries" % len(entries)
</code></pre>
<p>然后我得到一条错误消息:</p>
^{pr2}$
<p>sqlite3是否只接受<code>?</code>运算符?还是我搞砸了什么?在</p>