37,720
社区成员
发帖
与我相关
我的任务
分享
def log(r,c = 1, base = 2):
return int(c * math.log(r+1, base))
out = Image.eval(im,log)
out = Image.eval(im,log(c = 0.5, base = 10))
out = Image.eval(im, log(r,c = 0.5, base = 10))
Traceback (most recent call last):
File "<pyshell#22>", line 1, in <module>
out = Image.eval(im, log(r,c = 0.5, base = 10))
NameError: name 'r' is not defined
import math
def foo(c=1, base=10):
def bar(x):
res= c * math.log(x, base)
print '%d x log%d(%d) = %g' % (c, base, x, res)
return bar
f1 = foo()
f2 = foo(2, 5)
f1(100)
f2(25)