Python代码:
def konto_all():
lst = [[], []]
for index, x in enumerate(bankstm):
kontoall = x["FIELD7"].replace(",", "."), x["FIELD8"].replace(",", ".")
if kontoall != "" and index > 1:
lst[0].append(kontoall)
lst[1].append(x["FIELD1"].replace("-", ""))
return(lst)
kontoall1 = konto_all()
kontoall = kontoall1[0]
print(kontoall)
杰森文件:
{
"FIELD1": "2020-05-27",
"FIELD7": "",
"FIELD8": "56.00"
},
{
"FIELD1": "2020-05-25",
"FIELD7": "109.00",
"FIELD8": ""
},
{
"FIELD1": "2020-05-20",
"FIELD7": "78.90",
"FIELD8": ""
},
{
"FIELD1": "2020-05-19",
"FIELD7": "56.90",
"FIELD8": ""
},
{
"FIELD1": "2020-05-19",
"FIELD7": "46.80",
"FIELD8": ""
},
{
"FIELD1": "2020-05-18",
"FIELD7": "",
"FIELD8": "400.00"
},
电流输出:
[('', '56.00'), ('109.00', ''), ('78.90', ''), ('56.90', ''), ('46.80', ''), ('', '400.00')]
想要的输出:
[56.00, -109, -78.90, -56.90, -46.80, 400.00]
FIELD7 中的每个字符串都应该是负浮点数。FIELD8 中的每个字符串都应该是正浮点数。
Helenr
相关分类