Skip to content

Instantly share code, notes, and snippets.

@BlackMaria
Last active August 25, 2016 18:25
Show Gist options
  • Save BlackMaria/b48c64ffa303d8db24455390d82de25d to your computer and use it in GitHub Desktop.
Save BlackMaria/b48c64ffa303d8db24455390d82de25d to your computer and use it in GitHub Desktop.
def regex_params(data,search,replace):
tmp = {}
for i in data:
if re.search(search, i):
fixed = re.sub(search, replace, i)
tmp[fixed] = data[i]
for i in tmp:
if re.search(replace, i):
fixed = re.sub(replace, search, i)
data[i] = tmp[i]
del data[fixed]
return data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment