From 6f97554195b4f9de4d28782a706e5389ba756531 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Thu, 14 Sep 2023 20:18:51 +0200 Subject: [PATCH] Use `is None` instead of `== None` --- bnp_pdf_statement_parser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bnp_pdf_statement_parser.py b/bnp_pdf_statement_parser.py index a80c066..cf9bda3 100755 --- a/bnp_pdf_statement_parser.py +++ b/bnp_pdf_statement_parser.py @@ -46,7 +46,7 @@ for folder in os.listdir(): for line in lines: if not started: # We are interested in the content after this line: - if soldeCrediteurAuRegex.match(line) != None or (line.startswith('Date Nature des opérations Valeur Débit Crédit') and not firstPage): + if soldeCrediteurAuRegex.match(line) is not None or (line.startswith('Date Nature des opérations Valeur Débit Crédit') and not firstPage): if soldeCrediteurAuRegex.match(line): initialAmount = float(soldeCrediteurAuRegex.sub('', line).replace(',', '.').replace(' ', '')) currentAmount = initialAmount @@ -56,15 +56,15 @@ for folder in os.listdir(): continue else: # We aren't interested in the content after this line: - if line.startswith('BNP PARIBAS SA au capital de') or endPageAfterTheFirstOneRegex.match(line) != None: + if line.startswith('BNP PARIBAS SA au capital de') or endPageAfterTheFirstOneRegex.match(line) is not None: firstPage = False started = False continue # We aren't interested in the content after this line elif line.startswith('TOTAL DES OPERATIONS'): break - if firstLineOfPaymentRegex.match(line) != None: - if date != None: + if firstLineOfPaymentRegex.match(line) is not None: + if date is not None: print(date, valeur, amount, currentAmount) print('\n'.join(comment)) print()