-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