[問題] #'str' object is not callable
def power(a,n):
if(n==0):
return 1
elif(n==1):
return a
str="241,111,111,1"
a = str.split(',')[0]
b = str.split(',')[3]
print "a="+a
print "b="+b
print float(a)/float(b)
print "=============="
c=power(10,b)
print c #跑出None? 不太明白
print power(10,1)
#print a/power(10,b) 主要希望這樣
不好意思,還搞不清楚><"
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 116.59.247.38
→
05/23 21:14, , 1F
05/23 21:14, 1F
※ 編輯: blackspace98 來自: 116.59.247.38 (05/23 21:41)
→
05/23 21:42, , 2F
05/23 21:42, 2F
→
05/23 21:45, , 3F
05/23 21:45, 3F
※ 編輯: blackspace98 來自: 116.59.247.38 (05/23 22:29)
→
05/23 22:51, , 4F
05/23 22:51, 4F
→
05/24 00:14, , 5F
05/24 00:14, 5F
Python 近期熱門文章
PTT數位生活區 即時熱門文章