Name
array2string
Synopsis
array2string(a
,max_line_width
=None,precision
=None,suppress_small
=None,separator
=' ',array_output
=False)
Returns a string representation s
of array
a
, showing elements within brackets,
separated by string separator
. The last
dimension is horizontal, the penultimate one vertical, and further
dimensions are denoted by bracket nesting. If
array_output
is true,
s
starts with 'array(
'
and ends with ')
‘. s
ends with ",'X')
" instead if X
,
which is a
’s type code,
is not Float
, Complex
, or
Int
, which lets you later use
eval(
s
)
if separator
is ',
‘.
Lines longer than max_line_width
(by
default, 77
) are broken up.
precision
determines how many digits are
used per element (by default, 8
). If
suppress_small
is true, very small numbers
are shown as 0
. You can change these defaults by
binding attributes of module sys
named
output_line_width
,
float_output_precision
, and
float_output_suppress_small
.
str(
a
)
is like
array2string(
a
)
.
repr(
a
)
is like
array2string(
a
,separator='
,
',array_output=True)
.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.