本文簡要介紹 python 語言中 matplotlib.docstring.Substitution
的用法。
-
基礎:
object
對對象的文檔字符串執行 %-substitution 的裝飾器。
即使
obj.__doc__
為 None(例如,如果 -OO 被傳遞給解釋器),這個裝飾器也應該是健壯的。用法:構造一個 docstring.Substitution 用一個適合執行替換的序列或字典;然後用構造的對象裝飾一個合適的函數,例如:
sub_author_name = Substitution(author='Jason') @sub_author_name def some_function(x): "%(author)s wrote this function" # note that some_function.__doc__ is now "Jason wrote this function"
也可以使用位置參數:
sub_first_last_names = Substitution('Edgar Allen', 'Poe') @sub_first_last_names def some_function(x): "%s %s wrote the Raven"
用法
class matplotlib.docstring.Substitution(*args, **kwargs)
相關用法
- Python matplotlib SubFigure.subplots用法及代碼示例
- Python matplotlib SubplotSpec.subgridspec用法及代碼示例
- Python matplotlib SubFigure.add_axes用法及代碼示例
- Python matplotlib SubFigure.colorbar用法及代碼示例
- Python matplotlib SubFigure.sticky_edges用法及代碼示例
- Python matplotlib SubFigure用法及代碼示例
- Python matplotlib SubFigure.add_gridspec用法及代碼示例
- Python matplotlib SubFigure.add_subplot用法及代碼示例
- Python matplotlib SubFigure.align_xlabels用法及代碼示例
- Python matplotlib SubFigure.align_ylabels用法及代碼示例
- Python matplotlib SubFigure.legend用法及代碼示例
- Python matplotlib StarPolygonCollection.set_hatch用法及代碼示例
- Python matplotlib.sankey.Sankey用法及代碼示例
- Python matplotlib Spines用法及代碼示例
- Python matplotlib SpanSelector用法及代碼示例
- Python matplotlib StarPolygonCollection.sticky_edges用法及代碼示例
- Python matplotlib StarPolygonCollection用法及代碼示例
- Python matplotlib axvspan用法及代碼示例
- Python matplotlib Axes.get_legend_handles_labels用法及代碼示例
- Python matplotlib AbstractMovieWriter用法及代碼示例
- Python matplotlib triplot用法及代碼示例
- Python matplotlib boxplot用法及代碼示例
- Python matplotlib subplots用法及代碼示例
- Python matplotlib InsetPosition用法及代碼示例
- Python matplotlib ToolManager.toolmanager_disconnect用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.docstring.Substitution。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。