Python equivalent for C++ STL vector/list containers(C++ STL 向量/列表容器的 Python 等效项)
问题描述
Is there something similar in Python that I would use for a container that's like a vector and a list?
Any links would be helpful too.
You can use the inbuilt list - underlying implementation is similar to C++ vector. Although some things differ - for example, you can put objects of different type in one and the same list.
http://effbot.org/zone/python-list.htm
N.B.: Please keep in mind that vector and list are two very different data structures. List are heterogeneous, i.e. can store different object types, while C++ vectors are homogeneous. The data in vectors is stored in linear arrangement whereas in list is a collection of references to the type and the memory address of the variables.
这篇关于C++ STL 向量/列表容器的 Python 等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C++ STL 向量/列表容器的 Python 等效项
基础教程推荐
- C++输入/输出运算符重载 1970-01-01
- end() 能否成为 stl 容器的昂贵操作 2022-10-23
- C++ #define 1970-01-01
- C++按值调用 1970-01-01
- 初始化变量和赋值运算符 1970-01-01
- 明确指定任何或所有枚举数的整数值 1970-01-01
- C++定义类对象 1970-01-01
- 使用scanf()读取字符串 1970-01-01
- 分别使用%o和%x以八进制或十六进制格式显示整 1970-01-01
- C语言访问数组元素 1970-01-01