Skip to content

Instantly share code, notes, and snippets.

@wonderb0lt
Created May 27, 2013 21:18
Show Gist options
  • Save wonderb0lt/5659142 to your computer and use it in GitHub Desktop.
Save wonderb0lt/5659142 to your computer and use it in GitHub Desktop.
def powersplit(s, seperators):
if not seperators:
return s
result = s.split(seperators[0])
temp = []
for sep in seperators[1:]:
for substring in result:
for subsplit in substring.split(sep):
stripped = subsplit.strip()
if stripped:
temp.append(subsplit.strip())
result = temp
temp = []
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment