for i in range(len(b)):
print(i)
0
1
尝试获取每个文档的值:https://docs.modular.com/mojo/stdlib/builtin/tuple.html#get
for i in range(len(b)):
print(b.get[i, Int32]())
错误:
error: Expression [61]:20:21: cannot use a dynamic value in call parameter
print(b.get[i, Int32]())
^
expression failed to parse (no further compiler diagnostics)
无法迭代:
print(i)
error: Expression [71]:19:14: 'Tuple[Int, Int]' does not implement the '__iter__' method
for i in b:
^
expression failed to parse (no further compiler diagnostics)
无法索引:
print(b[0])
错误:
error: Expression [72]:19:12: 'Tuple[Int, Int]' is not subscriptable, it does not implement the `__getitem__`/`__setitem__` methods
print(b[0])
~^
expression failed to parse (no further compiler diagnostics)