我的Python代码中出现类型错误
代码:
my_cursor.execute("select Gender from student where Id=" + str(id))
g = my_cursor.fetchone()
g = "+".join(g)
错误:
n="+".join(n)
TypeError:只能加入可迭代的
您可以使用my_cursor
作为可迭代结果
my_cursor.execute("select Gender from student where Id=" + str(id))
result = "+".join(my_cursor)
你可以在这里看到更多