每当我尝试运行此代码时,它都会得到TypeError:“<;”“int”和“tuple”错误实例之间不支持,因为它返回int并另存为tuple,并且当我尝试分配返回值时 它的作用就好像它不是一个整数,您不能对它使用“<;>;+=-”
import cx_Oracle
conn = cx_Oracle.connect('emu/emu@127.0.0.1')
cur = conn.cursor()
cur.execute("select max(locationid) from location")
for line in cur:
maxID = line
IDofcity = 1
while IDofcity < maxID:
cur.execute(f"select city from location where locationid='{IDofcity}'")
for row in cur:
Nameofcities = ['']
Nameofcities.append(row)
IDofcity += 1
print(Nameofcities)
cur.close()
conn.close()
守则及;错误
您是否尝试过:
这使得maxID引用元组中的值,而不是元组本身
如果元组中有1个以上的项,您将得到:
相关问题 更多 >
编程相关推荐