Skip to content

Instantly share code, notes, and snippets.

@farfanoide
Last active August 29, 2015 14:07
Show Gist options
  • Save farfanoide/7703f8e890bf9c9c3c6f to your computer and use it in GitHub Desktop.
Save farfanoide/7703f8e890bf9c9c3c6f to your computer and use it in GitHub Desktop.
import re
data_ = re.compile('data_\w+')
day = re.compile('\d+')
month = re.compile('\w+')
data = open('feriados_crudo').readlines()
def string_to_date(string):
d = day.findall(string)
m = month.findall(day.sub('', string))
return m, d
def parse(string):
print string_to_date(data_.findall(string)[0])
for line in data:
parse(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment