Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import re
- import sys
- for line in sys.stdin:
- line = line.lower();
- line = "".join(re.split('checkcard\s[0-9]{4}',line))
- cost_re=re.search('(?<=-)?[0-9]*\.[0-9]{2}(?<=-)?',line)
- line = line.replace("&","and")
- name_re=re.search('([a-zA-Z]+[\*\-\&\']?\w* ?){1,3}',line)
- if cost_re is not None and name_re is not None:
- cost=float(cost_re.group(0))
- name=name_re.group(0)
- print "%s\t%f" % (name.upper(), cost)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement