python - Python 检查中 <..> 的含义

标签 python

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

相关文章:

python - 从类中的另一个静态方法函数调用函数

python - 为无限循环运行两个类

python - PyQt 项目 View 自定义拖放

python - 解析 FHIR 捆绑 JSON Apache Spark

python - 使用 del 和切片是否会先创建一个新对象,然后再删除?会就位吗?

python - Jinja 使用 for 列出嵌套 JSON

python - 在Python中使用相同的键在字典中查找不同的值

Python Pandas 在相同 len() 的两列中使用不同的 value_counts()

python - sys.path 修改不适用于 python2 但适用于 python3

python - 我可以在Python中离线使用plotly图形工厂吗?