我需要 Python 中的一个结构,它将整数索引映射到浮点数向量。我的数据是这样的:
[0] = {1.0, 1.0, 1.0, 1.0}
[1] = {0.5, 1.0}
Run Code Online (Sandbox Code Playgroud)
如果我用 C++ 编写此代码,我将使用以下代码进行定义/添加/访问,如下所示:
std::unordered_map<int, std::vector<float>> VertexWeights;
VertexWeights[0].push_back(0.0f);
vertexWeights[0].push_back(1.0f);
vertexWeights[13].push_back(0.5f);
std::cout <<vertexWeights[0][0];
Run Code Online (Sandbox Code Playgroud)
Python 中 this 的等效结构是什么?