从英文文本生成python标识符
pydentifier的Python项目详细描述
从英文文本生成python标识符。对代码生成很有用。
类名:
>>>pydentifier.upper_camel("I'm a class",prefix='')'IAmAClass'
函数名:
>>>pydentifier.lower_underscore('This is a function',prefix='')'this_is_a_function'
保留关键字:
>>>pydentifier.lower_underscore('class',prefix='')'class_'
内部方法:
>>>pydentifier.lower_underscore("Shouldn't touch this",prefix='_')'_should_not_touch_this'
专用方法:
>>>pydentifier.lower_underscore("Can't touch this",prefix='__')'__cannot_touch_this'