0
我不断收到类型错误:“浮动”对象未标化的 想知道为什么类型错误:“浮动”对象未标化的Python 3
from math import log
class Logarithm(object):
def __init__(self, base = 0, number= 0):
self.base = float(base)
self.number = float(number)
the_logarithm = log(self.base[self.number])
def __str__(self):
return 'Your log = {}'.format(the_logarithm)
也,它应该是'self.the_logarithm'(均在'__init__'和'__str__' )。 – nvlass 2013-05-06 23:09:04