命令风格
命名中文名称说明用途举例camel case (lowerCamelCase)驼峰式命名法(小驼峰)首字母为小写变量、函数名userNamepascal case(UpperCamelCase)帕斯卡命名法(大驼峰)首字母大写类名UserNamesnake case蛇形命名法--user_namekebab case串式命名法-项目文件夹project-nameupper case大写命名法-常量、枚举DATABASE_URLPyPI: https://pypi.org/project/case-convert/
安装
pip install case-convert
代码示例
# -*- coding: utf-8 -*-
from case_convert import (
camel_case,
kebab_case,
pascal_case,
snake_case,
upper_case
)
text = 'hello_world'
print(camel_case(text)) # helloWorld
print(kebab_case(text)) # hello-world
print(pascal_case(text)) # HelloWorld
print(snake_case(text)) # hello_world
print(upper_case(text)) # HELLO_WORLD