Skip to content

Instantly share code, notes, and snippets.

@lw
Created July 27, 2013 12:59
Show Gist options
  • Save lw/6094802 to your computer and use it in GitHub Desktop.
Save lw/6094802 to your computer and use it in GitHub Desktop.
import re
def camelcase_to_underscore(name):
return "_".join(w.lower() for w in re.findall("(?:[A-Z][a-z]+|[A-Z]+(?:$|(?=[A-Z][a-z])))", name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment