code:
import sqlite3
def getstrings():
return input().strip().split()
def getint():
return int(input())
def getints():
return list(map(int, input().strip().split()))
n = int(input())
# conn = sqlite3.connect('./test.sqlite')
conn = sqlite3.connect(':memory:')
cur = conn.cursor()
for i in range(n):
table_name = input().strip()
x, y = getints()
headers = getstrings()
cur.execute(f"CREATE TABLE {table_name} ({','.join([head + ' TEXT' for head in headers])})")
conn.commit()
for j in range(x-1):
cur.execute(f"INSERT INTO {table_name} VALUES ({','.join(['?' for _ in range(y)])})", getstrings())
conn.commit()
m = getint()
for i in range(m):
sql = input().strip()
first, second = sql.split('=')
second = f"'{second}'"
sql = first + '=' + second
cur.execute(sql)
for row in cur.fetchall():
print(' '.join(map(str, row)))
这个代码能够通过题目中的所有样例,但为什么后面的测试点运行异常?