私たちの講師は私たちに課題を助けるためのコードを与えてくれました。実行しようとすると構文エラーが出ます。私はコードを一切触れておらず、何も変えずに走ることを意図しています。これは、我々が与えられた半分のコードです:print()との構文エラー
class Flusher(MessageProc):
def main(self):
super().main()
print('before start message')
self.receive(
Message(
'start',
action=self.flush))
print('after start message')
self.receive(
Message(
ANY,
action=lambda data:print('The first thing in the queue after the flush is', data)))
def flush(self, *args):
self.receive(
Message(
ANY,
action=self.flush), # recursively call the flush method
TimeOut(
0,
action=lambda: None)) # when no more messages return
、例外をスローラインは次のとおりです。
action=lambda data:print('The first thing in the queue after the flush is', data)
これには、誰かが何を間違っているとどのような私を説明することができますしてくださいパイソンを使用して私の最初の時間ですそれを修正する必要があります。
EDIT:エラートレースは、次のとおりです。
File "./demo_timeout.py", line 18
action=lambda data:print('The first thing in the queue after the flush is' + data)))
^
SyntaxError: invalid syntax
完全なエラートレースを投稿してください... –
あなたはPython 2または3ですか?本気ですか? – user2357112
@ user2357112私はpython 3を使用しています – Kat42912