連接到資料庫 psycopg2 connectiondetails
${count}= row count select count(*) from trial;
log to console ${count}
-----這里 m?? 得到結果為 [(2,)] ,盡管我想將此結果與字串作為值 '2' 進行比較。如何從串列中獲取。
uj5u.com熱心網友回復:
查詢結果總是這樣回傳;帶有元組的串列,或使用選項returnAsDict
您可以通過索引訪問該值,或轉換為其他格式。在您的示例中:
# ${count} is [(2,)]
log to console ${count[0][0]}
但是,如果您查看檔案Row Count中的示例,您會發現他們不使用,因此您的代碼應該是:count(*)
${count}= row count select * from trial;
log to console ${count}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/426918.html
上一篇:填充NULL并獲得不同的記錄
