在 IPython session 中,我有以下内容:
> my_array?
Type: ndarray
String Form:
[[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.] <...> [ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]
[ 1.]]
Length: 500
什么是 <...>
上面的意思是?我有一个一维数组的一维数组还是其他什么?
最佳答案
<...>
这就是 IPython 在字符串太长时跳过值的方式。在 IPython/core/oinspect.py :
# String form, but snip if too long in ? form (full in ??)
if detail_level >= self.str_detail_level:
try:
ostr = str(obj)
str_head = 'string_form'
if not detail_level and len(ostr)>string_max:
ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
ostr = ("\n" + " " * len(str_head.expandtabs())).\
join(q.strip() for q in ostr.split("\n"))
out[str_head] = ostr
except:
pass
关于python - Python 检查中 <..> 的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14638261/