Pārlūkot izejas kodu

Handle decimal point

karianne
Sindre Stephansen pirms 3 gadiem
vecāks
revīzija
c662646407
1 mainītis faili ar 10 papildinājumiem un 1 dzēšanām
  1. +10
    -1
      ynab.py

+ 10
- 1
ynab.py Parādīt failu

@@ -29,7 +29,16 @@ def convert(reader, writer):
money_out = 0
money_in = 0

money = float(row[3].replace(',', '.'))
if (isinstance(row[3], str)):
moneystr = row[3].replace(',', '.')

try:
money = float(moneystr) if moneystr else 0
except ValueError as e:
print(f'Error in row {row}')
raise e
else:
money = float(row[3])

if money >= 0:
money_in = money


Notiek ielāde…
Atcelt
Saglabāt