gpt4 book ai didi

python - 操纵列表的列表

转载 作者:太空宇宙 更新时间:2023-11-03 14:02:48 26 4
gpt4 key购买 nike

在我的脚本中,我尝试从数据库中获取记录作为列表列表

KEYWORD Collections . Log List ${query_results}
Documentation:
Logs the length and contents of the list using given level.

Start / End / Elapsed: 20180306 20:49:59.894 / 20180306 20:49:59.894 / 00:00:00.000
20:49:59.894 INFO List length is 20 and it contains following items:
0: ('3/6/2018', 6, 3, ' 50.00', 984, 286, 29.07)
1: ('3/5/2018', 6, 4, ' 66.67', 984, 866, 88.01)
2: ('3/4/2018', 6, 4, ' 66.67', 984, 976, 99.19)
3: ('3/3/2018', 6, 4, ' 66.67', 984, 884, 89.84)
4: ('3/2/2018', 6, 4, ' 66.67', 984, 864, 87.8)
5: ('3/1/2018', 7, 5, ' 71.43', 1848, 1440, 77.92)
6: ('2/28/2018', 6, 4, ' 66.67', 1656, 1248, 75.36)
7: ('2/27/2018', 6, 4, ' 66.67', 1656, 1248, 75.36)
8: ('2/26/2018', 6, 1, ' 16.67', 1656, 1248, 75.36)
9: ('2/25/2018', 6, 1, ' 16.67', 1656, 1056, 63.77)
10: ('2/24/2018', 8, None, None, 816, 80, 9.8)
11: ('2/23/2018', 11, 3, ' 27.27', 1464, 128, 8.74)
12: ('2/22/2018', 11, 7, ' 63.64', 2232, 1292, 57.89)
13: ('2/21/2018', 11, 2, ' 18.18', 2232, 1239, 55.51)
14: ('2/20/2018', 11, None, None, 2232, 184, 8.24)
15: ('2/19/2018', 6, None, None, 1752, 0, 0)
16: ('2/18/2018', 6, None, None, 528, 0, 0)
17: ('2/17/2018', 6, None, None, 528, 0, 0)
18: ('2/16/2018', 7, None, None, 1680, 0, 0)
19: ('2/15/2018', 6, 2, ' 33.33', 1584, 93, 5.87)

正如您所看到的,一些数据为 None(它们是来自数据库的 NULL 值)。我想将这些数据替换为 0.00。我不知道如何在机器人框架中执行此操作。有人可以帮助我实现这一目标吗?

最佳答案

感谢 A.kootstra 的想法。

我可以在 SQL 查询中使用 Oracle 函数来处理此问题,而不是在机器人框架级别处理此问题。

i.e.  nvl(to_char(mycolumn), '0')  This Replaces NULL to desired value

关于python - 操纵列表的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49134401/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com