(Python Reqex) reading dates and dollar figures from phone text
import re # open a text file f = open("phone.txt", 'r') # extract the file's content content = f.read() # a regular expression pattern to match dates pattern = "\d{2}[/-]\d{2}[/-]\d{4}" dates = re.findall(pattern, content) for date in dates: print(date) f.close() __________________________________ output: 09/01/2021 09/14/2021 09/24/2021 My question is: on the text file I have numbers with $ and dates I was trying to print the number next to the dates that they match on, example of desire output ; Date: 09/01/2021. total: $7.30. sample line going over pass lessons on Character classes and Metacharacters, and groups to get this far on matching dates. Just can't fig out the side-by-side thing on totals next to dates after a day, I am thinking should I be using import panada as pd along with import re to get columns for the data?