语音AI帮助Unicode无法调用

时间:2018-10-23 15:28:26

标签: python

一直说无法调用unicode,我该如何解决?

这是我要执行的代码

if 'weather forecast in' in command:
        reg_ex = re.search('weather forecast in (.*)', command)
        if reg_ex:
            city = reg_ex.group(1)
            weather = Weather()
            location = weather.lookup_by_location(city)
            forecasts = location.forecast
            for i in range(0,3):
                talkToMe('On %s will it %s. The maximum temperture will be %.1f degrees.''The lowest temperature will be %.1f degrees.' % (forecasts[i].date(), forecasts[i].text(), (int(forecasts[i].high())-32)/1.8, (int(forecasts[i].low())-32)/1.8))

我使用的是Mac,因此终端告诉我Unicode无法调用。

我在终端收到的错误消息

    Traceback (most recent call last):
  File "Untitled3.py", line 172, in <module>
    myCommand()
  File "Untitled3.py", line 42, in myCommand
    assistant(command)
  File "Untitled3.py", line 128, in assistant
    talkToMe('On %s will it %s. The maximum temperture will be %.1f degrees.''The lowest temperature will be %.1f degrees.' % (forecasts[i].date(), forecasts[i].text(), (int(forecasts[i].high())-32)/1.8, (int(forecasts[i].low())-32)/1.8))
TypeError: 'unicode' object is not callable

0 个答案:

没有答案