[英]Python data structure like dict
Online I found some code that used the variable explored
. 在网上我找到了一些使用所explored
变量的代码。 This variable is implemented like a dictionary: explored = {rootId}
, but it doesn't have key-value association, moreover this variabile uses the function .add(elem)
while the dict doesn't have this function. 该变量的实现方式类似于字典: explored = {rootId}
,但它没有键值关联,而且此变量使用.add(elem)
函数,而dict没有此功能。 eg. 例如。 explored.add(elem)
. explored.add(elem)
。
Which data structure is that? 那是哪种数据结构? (I'm using python 3.6.3) (我正在使用python 3.6.3)
可能是一个集合,它具有方法“ add”,但是您可以简单地打印类型,例如:
print(type(explored))
It's the set
datastructure. 这是set
结构。 Here's a link to it on the official docs: https://docs.python.org/3/tutorial/datastructures.html#sets 这是官方文档上的链接: https : //docs.python.org/3/tutorial/datastructures.html#sets
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.