Skip to content

Instantly share code, notes, and snippets.

@minghan
Created July 13, 2011 20:18
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 minghan/1081224 to your computer and use it in GitHub Desktop.
Save minghan/1081224 to your computer and use it in GitHub Desktop.
Camecase to Underscore lowercase
import re
def underscore(text):
def repl(m):
return "_" + m.group(0).lower()
return re.sub(r"([A-Z])", repl, text)
print underscore("helloWorld")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment