numpy.printoptions
- numpy.printoptions(*args, **kwargs)[source]
-
Контекстный менеджер для настройки параметров вывода.
Настройте параметры вывода в рамках
withблока и восстановите старые параметры в конце. См.set_printoptionsдля полного описания доступных параметров.См. также
Примеры
>>> from numpy.testing import assert_equal >>> with np.printoptions(precision=2): ... np.array([2.0]) / 3 array([0.67])
В
as-частиwith-выражения отображаются текущие параметры вывода:>>> with np.printoptions(precision=2) as opts: ... assert_equal(opts, np.get_printoptions())
© 2005–2022 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.21/reference/generated/numpy.printoptions.html