dblist = ('database1', 'database2', 'database3', 'database4', 'database5', 'database6', 'database7')
for db in dblist:
cursor = conn.cursor()
cursor.execute("select SYSTEM from automation/awdclient where db = " + "'" + db + "'" + "")
for row in cursor:
activesystem.db = row[0]
cursor.close
conn.close
print activesystem.database1
print activesystem.database2
我正在做的是从数据库中检索系统名称。我想分配一个等于该系统名称的变量,变量名称为 system.whatever db 字符串。