Skip to content

Instantly share code, notes, and snippets.

@MCMXCIII
Created January 4, 2021 03:52
Show Gist options
  • Save MCMXCIII/580d9c8b809f40eecb44a009efb37fbd to your computer and use it in GitHub Desktop.
Save MCMXCIII/580d9c8b809f40eecb44a009efb37fbd to your computer and use it in GitHub Desktop.
Code block Regex
py import csv
import re
address_filter=[] #an empty list to store the second column
with open('122023jan.csv', 'r', encoding="utf8") as rf:
reader = csv.reader(rf, delimiter=',')
for row in reader:
str(address_filter.append(row[9]))
#print(noise_amp)
regexp = "(\w+), ([A-Z]{2} [0-9]{5})"
regexp = "(\w+) (\w+), ([A-Z]{2} [0-9]{5})"
address = re.findall(regexp, noise_amp)
print(address)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment