【发布时间】:2021-02-18 13:14:28
【问题描述】:
我有一个字典,我可以在 python 中使用它进行迭代
data = {"one":1,"two":2,"three":3,"four":4,....."two hundred":200}
for i,j in data.items():
print(i,j)
有什么方法可以使用同一个对象并迭代 rust 中的键和值?
【问题讨论】:
-
for (i, j) in data(i和j是拥有值)或for (r, s) in &data(r和s是引用) -
你问的是同一件事的 Rust 语法吗?或者“相同的对象”是指使用 PyO3 或其他东西从 Rust 访问 Python 对象?
标签: loops dictionary rust hashmap