How to delete a dict_key in python -


i trying code algorithm dijkstra in python3 , think have confused python 2 , python 3. want remove unseen_node. code shown below

d={} p={}  node in graph.keys():     d[node] = -1     p[node] = "" d[start] = 0 unseen_nodes = graph.keys()  #graph dict while len(unseen_nodes)>0:     shortest = none     node = ''      temp_node in unseen_nodes:         if shortest == none:             shortest = d[temp_node]         elif(d[temp_node]<shortest):             shortest = d[temp_node]             node=temp_node      unseen_nodes.remove(node) #gives attributeerror:                               'dict_keys' object has no attribute'remove' 


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -