tuple为空怎么用if来进行判断
t=()
if t==None:
print "hello"
else:
print "world"
主要是下面这个函数给我的困扰
def average(*args):
n=0
sum1=0.0
arg=0
#if args==None error why?
if len(args)==0:
return 0.0
for x in args:
n=n+1
sum1=sum1+x
arg=sum1/n
return arg
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)