mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-10 00:06:13 +00:00
6 lines
184 B
Python
6 lines
184 B
Python
import re
|
|
|
|
|
|
def camelcase_to_underscore(str):
|
|
# http://djangosnippets.org/snippets/585/
|
|
return re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', str).lower().strip('_')
|