numpy.get_printoptions#

numpy.get_printoptions()[原始碼]#

傳回目前的列印選項。

傳回值:
print_optsdict

目前列印選項的字典,包含以下鍵

  • precision : int

  • threshold : int

  • edgeitems : int

  • linewidth : int

  • suppress : bool

  • nanstr : str

  • infstr : str

  • sign : str

  • formatter : dict of callables

  • floatmode : str

  • legacy : str or False

關於這些選項的完整說明,請參閱 set_printoptions

範例

>>> import numpy as np
>>> np.get_printoptions()
{'edgeitems': 3, 'threshold': 1000, ..., 'override_repr': None}
>>> np.get_printoptions()['linewidth']
75
>>> np.set_printoptions(linewidth=100)
>>> np.get_printoptions()['linewidth']
100