加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

在Python 3.2上返回True时出现’语法错误’

发布时间:2020-12-20 12:27:55 所属栏目:Python 来源:网络整理
导读:我现在的脚本中有以下功能: def _convert_time(p): """Converts a percentage into a date,based on current date.""" # This is the number of years that we subtract from # the current date. p_year = pow(math.e,(20.344 * pow(p,3) + 3)) - pow(math
我现在的脚本中有以下功能:

def _convert_time(p):
    """Converts a percentage into a date,based on current date."""

    # This is the number of years that we subtract from
    # the current date.
    p_year = pow(math.e,(20.344 * pow(p,3) + 3)) - pow(math.e,3)

    # Returns in YYYY-MM-DD format
    date_in_history = date.today() - timedelta(days=(p_year * 365)

    # Return to the control loop
    return True

我的所有函数都使用这个系统在最后返回True,这是因为有一个中心函数按顺序运行每个函数并检查它们是否在执行下一个函数之前正确运行.

但是,当我运行脚本时,在我输入值以启动脚本之前,我收到以下错误:

File "C:UsersCallumDesktopTempusTempusTest.py",line 59
 return True
      ^

如果我在IDLE中创建一个返回True的函数并检查它,它工作正常,但由于某种原因它不在我的脚本中

你们有没有想过为什么会这样?

谢谢!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读