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 等效项
- 使用整数值初始化char类型的变量 1970-01-01
- 运算符优先级 1970-01-01
- C语言求模 1970-01-01
- C++浮点常数 1970-01-01
- 打印扩展的ASCII字符 1970-01-01
- C语言可使用的所有转义序列 1970-01-01
- “纯虚函数调用"在哪里?崩溃从何而来? 2022-10-18
- 使用最流行的转义序列 1970-01-01
- C++指向数组的指针 1970-01-01
- 使用来自float.h和limits的数据,找到该系统的一些 1970-01-01