Python格式化错误

时间:2016-01-06 01:33:16

标签: python

问题是什么?我试着寻找标签,但我没有看到。

File "/home/pi/jasper/client/modules/Wikipedia.py", line 24
  mic.say("Okay, what would you like me to look up?")
                                                    ^
IndentationError: unindent does not match any outer indentation level
            """
            Responds to user-input, typically speech text, by relaying the
            entry from Wikipedia.

            Arguments:
            text -- user-input, typically transcribed speech
            mic -- used to interact with the user (for both input and output)
            profile -- contains information related to the user (e.g., phone
               number)
            """

    mic.say("Okay, what would you like me to look up?")

    def sayDefinition(text):
        mic.say(mic.say(wikipedia.summary(text, sentences=2)))

    sayDefinition(mic.activeListen())

1 个答案:

答案 0 :(得分:1)

doc字符串的缩进应与下一行相同:

    """
    Responds to user-input, typically speech text, by relaying the
    entry from Wikipedia.

    ...
    """
    mic.say("Okay, what would you like me to look up?")

有关indenting code的更多信息。