本文簡要介紹 python 語言中 numpy.source
的用法。
用法:
numpy.source(object, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)
將 NumPy 對象的源代碼打印或寫入文件。
僅針對用 Python 編寫的對象返回源代碼。許多函數和類是用 C 定義的,因此不會返回有用的信息。
- object: numpy 對象
輸入對象。這可以是任何對象(函數、類、模塊……)。
- output: 文件對象,可選
如果未提供輸出,則將源代碼打印到屏幕(sys.stdout)。文件對象必須使用寫入 ‘w’ 或附加 ‘a’ 模式創建。
參數:
例子:
>>> np.source(np.interp) In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py def interp(x, xp, fp, left=None, right=None): """.... (full docstring printed)""" if isinstance(x, (float, int, number)): return compiled_interp([x], xp, fp, left, right).item() else: return compiled_interp(x, xp, fp, left, right)
僅針對用 Python 編寫的對象返回源代碼。
>>> np.source(np.array) Not available for this object.
相關用法
- Python numpy sort用法及代碼示例
- Python numpy sort_complex用法及代碼示例
- Python numpy searchsorted用法及代碼示例
- Python numpy shape用法及代碼示例
- Python numpy scimath.log用法及代碼示例
- Python numpy signbit用法及代碼示例
- Python numpy setdiff1d用法及代碼示例
- Python numpy seterr用法及代碼示例
- Python numpy scimath.logn用法及代碼示例
- Python numpy square用法及代碼示例
- Python numpy std用法及代碼示例
- Python numpy scimath.log2用法及代碼示例
- Python numpy sum用法及代碼示例
- Python numpy spacing用法及代碼示例
- Python numpy seterrobj用法及代碼示例
- Python numpy squeeze用法及代碼示例
- Python numpy scimath.arccos用法及代碼示例
- Python numpy shares_memory用法及代碼示例
- Python numpy s_用法及代碼示例
- Python numpy swapaxes用法及代碼示例
- Python numpy sctype2char用法及代碼示例
- Python numpy show_config用法及代碼示例
- Python numpy set_printoptions用法及代碼示例
- Python numpy save用法及代碼示例
- Python numpy scimath.log10用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.source。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。