Untitled
unknown
plain_text
5 days ago
984 B
3
Indexable
Never
def process_curr(amount,curr): if curr in ["EUR","USD","SGD","BRL"]: return "{:.2f}".format(amount / 100) elif curr in ["JPK","ISK","KRW"]: return "{:.2f}".format(amount / 1) else: return None def func(rows): ans=[] curr_card="" curr_dict="" for row in rows: if "_" in row: curr_card=row.split('_')[0] continue if "transaction" in row: curr_dict = row continue info=dict(zip(curr_dict.split(','), row.split(','))) if not(str(info["evidence_due_by"]).isdigit()) or not(str(info["amount"]).isdigit()) or process_curr(info["amount"],info["currency"])==None: continue ans_str=[curr_card+str(info["transaction"]),str(info["merchant"]),process_curr(info["amount"],info["currency"])+info[2],info["evidence_due_by"]] ans.append((info["transaction"],ans_str)) ans=sorted(ans) ans=[i[1] for i in ans] return "\n".join(ans)
Leave a Comment