1
我對python相當陌生,無法在任何地方找到我的問題的答案。除非我不明白給出的答案。 我有一個數據庫遊標,我執行以下命令:從Python中調用fetchone()調用的值3
cmd = 'select value from measurement where measurement_location is ?'
crs.execute(cmd, [location_id])
print(crs.fetchone())
它打印:
{'value': 73.97486139568466}
我需要使用浮動73.97 ....在一些計算來計算的平均值。 我的問題是,我不知道如何從fetchone()返回拉浮動。
你也可以使用'row.get(「值」)做' –