Skip to content

Instantly share code, notes, and snippets.

@HyShai

HyShai/scores.py Secret

Created November 16, 2014 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HyShai/a2bd2f59cf6b023a1b93 to your computer and use it in GitHub Desktop.
Save HyShai/a2bd2f59cf6b023a1b93 to your computer and use it in GitHub Desktop.
scores.py
import re
scores = [[u'Orlando 81 Washington 90 (3:55 IN 4TH)'], [u'Atlanta 59 Cleveland 87 (3:51 IN 3RD)'], [u'Utah 62 Toronto 69 (3:59 IN 3RD)'], [u'Indiana 46 Chicago 42 (0:03 IN 2ND)'], [u'Detroit 50 Memphis 51 (0:18 IN 2ND)'], [u'Minnesota 22 Dallas 28 (0:00 IN 1ST)'], [u'Brooklyn at Portland (10:00 PM ET)'], [u'San Antonio at Sacramento (10:00 PM ET)'], [u'Charlotte at Golden State (10:30 PM ET)'], [u'Phoenix at LA Clippers (10:30 PM ET)']]
for score in scores:
print score
print re.sub('([a-zA-Z^ ]+?)(\\d+|at)\\s+?([a-zA-Z^ ]+?)(\\d+)?\\s+?(\\(.+\\))\\s+?', 'whatever replacment', score[0])
@HyShai
Copy link
Author

HyShai commented Nov 16, 2014

@cclaus - hmmm interesting - that's definitely more readable than my regex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment