我正在尝试将sql输出的输出连接到字符串,如下所示:
dwh_cur.execute("""select name from sales where id = 123""")
name = dwh_cur.fetchone()[0]
a = print(name)
b = str(a) + " is the name of the agent"
print(b)
以上返回
None is the name of the agent
预期输出:
Steve is the name of the agent
答案 0 :(得分:1)
a = print(name)
不返回
尝试:
b = "{} is the name of the agent".format(name)