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

备注

这些打印选项仅适用于 NumPy ndarray,不适用于标量。

并发注意事项: 请参阅 文本格式化选项

示例

>>> 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