-2
我试图推动一个项目在Python的堆栈。下面是试图推动该项目的代码:在python中使用堆栈给出了NoneType错误
class Search
def generalGraphSearch(problem,fringe):
closed=set()
#If no nodes
if problem.isGoalState(problem.getStartState()):
return problem.getStartState()
#Create object of Stack class
stackOb = util.Stack()
"""Push the starting node into the stack. The parameter is the state"""
stackOb.push(problem.getStartState())
print stackOb.push(problem.getStartState())
The stack implementation is as below :
class Stack:
"A container with a last-in-first-out (LIFO) queuing policy."
def __init__(self):
self.list = []
def push(self,item):
"Push 'item' onto the stack"
self.list.append(item)
在搜索类print语句给出类型为无
任何建议如何解决这个问题? 感谢
谢谢您的回复。它帮助 – user6622569
@ user6622569好的,当然,看看你能否接受答案,谢谢。 – alecxe