Python関数コメントフォーマット
1909 ワード
ノートは自分に注意する
def pinyin(hans, style=Style.TONE, heteronym=False,
errors='default', strict=True):
""" .
:param hans: ( ``' '`` ) ( ``[' ', ' ']`` ).
,
。
:type hans: unicode
:param style: , :py:attr:`~pypinyin.Style.TONE` 。
:class:`~pypinyin.Style`
:param errors:
* ``'default'``:
* ``'ignore'``:
* ``'replace'``: ``\\u`` unicode
(``'\\u90aa'`` => ``'90aa'``)
* callable : 。 ``errors``
, :
``func(char)``::
def foobar(char):
return 'a'
pinyin('あ', errors=foobar)
:param heteronym:
:param strict: 《 》 , :ref:`strict`
:return:
:rtype: list
Usage::
>>> from pypinyin import pinyin, Style
>>> import pypinyin
>>> pinyin(' ')
[['zhōng'], ['xīn']]
>>> pinyin(' ', heteronym=True) #
[['zhōng', 'zhòng'], ['xīn']]
>>> pinyin(' ', style=Style.FIRST_LETTER) #
[['z'], ['x']]
>>> pinyin(' ', style=Style.TONE2)
[['zho1ng'], ['xi1n']]
>>> pinyin(' ', style=Style.CYRILLIC)
[['чжун1'], ['синь1']]
"""
#
if isinstance(hans, text_type):
....