Convert CamelCase to lowercase_with_underscores

1
camelcase_to_underscore = lambda str: re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', '_\\1', str).lower().strip('_')

More like this

  1. Convert String Uppercase and Lowercase by oraculum 2 years, 1 month ago
  2. Human readable file names decorator by maxk 2 years, 1 month ago
  3. slug filename by willhardy 3 years, 10 months ago
  4. Url filter middleware by limodou 6 years, 2 months ago
  5. Cached model property decorator (like @property) by homunq 1 year, 5 months ago

Comments

(Forgotten your password?)