Created
October 5, 2014 12:13
-
-
Save zguangyu/e949e576fd53378dec16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import json | |
ori = '[1-5,8]' | |
m = re.search(r'([0-9]+)-([0-9]+)', s) | |
s = '' | |
for i in range((m.groups()[0]), (m.groups()[1])+1): | |
s += str(i)+',' | |
l = re.sub(r'[0-9]+-[0-9]+,', s, '[1-5,8]') | |
out = json.loads(l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment