mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
e7227db41a
* starting insert prints * working exec_script * remove prints, fix exec_examples.py * more cleanup of examples, better model printing * upgrade netlify runtime * extra docs deps * few more small tweaks
17 lines
394 B
Python
17 lines
394 B
Python
from pydantic import BaseModel
|
|
|
|
def to_camel(string: str) -> str:
|
|
return ''.join(word.capitalize() for word in string.split('_'))
|
|
|
|
class Voice(BaseModel):
|
|
name: str
|
|
gender: str
|
|
language_code: str
|
|
|
|
class Config:
|
|
alias_generator = to_camel
|
|
|
|
voice = Voice(Name='Filiz', Gender='Female', LanguageCode='tr-TR')
|
|
print(voice.language_code)
|
|
print(voice.dict(by_alias=True))
|