计算机分配1 Int对​​象不可调用

时间:2015-01-11 21:14:57

标签: python

这是我的代码:

import math as m

year = 1996.
month = 9
day = 21
y2 = 96  # The number of years since 1900 with the simple subtraction of y2 = year - 1900

em = 0 (# An early-month correction factor that is either 0 or 1 using
    m.floor((14 - month)/ 12 ))

y3 = 96  (# year with early-month correction using
    y3 = y2 - em)

m2 = 9  (# month with early-month correction using
    m2 = month + 12*em)

l = 121.03 (# number of leap years since 1900 using the formula
    l = 1 + min(y3, 0) + m.floor(y3/4) - m.floor(y3/100) + m.floor((y3+300)/400))

d1 = 243 (# number of days preceding the given month in a non-leap year using
    d1 = m.floor(-1.63 + (m2 - 1)*30.6))

d2 = 35425.03 (# final excel date using
    d2 = day + y3 * 365 + l + d1)

print "Birth Excel Date at 0.00 hours into 1996-09-21: d2"

但根据树冠,这里有一个错误:

22 
     23 em = 0 (# An early-month correction factor that is either 0 or 1 using
---> 24     m.floor((14 - month)/ 12 ))
     25 
     26 y3 = 96  (# year with early-month correction using

TypeError: 'int' object is not callable 

2 个答案:

答案 0 :(得分:2)

删除包含所有评论的括号

x = 5  # This is a comment

y = 3 (#This is not a comment)

答案 1 :(得分:1)

由于你的评论是如何构建的,你失败了:

em = 0 (# An early-month correction factor that is either 0 or 1 using
    m.floor((14 - month)/ 12 ))

您的括号表示您正在调用函数:

0()

这是无效的 - 您的错误告诉您。

要更正此问题,请删除括号:

em = 0 # An early-month correction factor that is either 0 or 1 using