humps¶
Release v3.8.0. (Installation)
humps 🐫 Convert strings (and dictionary keys) between snake case, camel case and pascal case in Python. Inspired by Humps for Node
Introducing Humps for Python! Let’s see it in action:
>>> import humps
>>> humps.decamelize('illWearYourGranddadsClothes') # 'ill_wear_your_granddads_clothes'
>>> humps.camelize('i_look_incredible') # 'iLookIncredible'
>>> humps.kebabize('i_look_incredible') # 'i-look-incredible'
>>> humps.pascalize('im_in_this_big_ass_coat') # 'ImInThisBigAssCoat'
>>> humps.decamelize('FROMThatThriftShop') # 'from_that_thrift_shop'
>>> humps.decamelize([{'downTheRoad': True}]) # [{'down_the_road': True}]
>>> humps.dekebabize('FROM-That-Thrift-Shop') # 'FROM_That_Thrift_Shop'
Features¶
- Convert from
snake_casetocamelCaseandPascalCaseandkebab-case - Convert from
camelCasetosnake_caseandPascalCase - Convert from
PascalCasetosnake_caseandcamelCase - Convert from
kebab-casetosnake_case - Supports recursively converting
dictkeys - Supports recursively converting lists of dictionaries
- Gracefully handles abbrevations, acronyms, and initialisms
- Extensively documented source code
- No third-party dependencies