我有兩個腳本一個工作,另一個具有給變量賦予正確值的函數。導入其他不能正常工作的python文件函數
while True:
day = raw_input("Please Enter The Day: ")
month = raw_input("Please Enter The Month: ")
year = raw_input("Please Enter The Year: ")
if day.isdigit():
if day > 0:
correctcheck = "1"
else:
print "You Did Not Enter A Valid Day"
errormsg = "1"
break
else:
print "You Did Not Enter A Valid Day"
errormsg = "1"
break
if month.isdigit():
if month > 0:
correctcheck = "2"
else:
print "You Did Not Enter A Valid Month"
errormsg = "1"
break
else:
print "You Did Not Enter A Valid Month"
errormsg = "1"
break
if year.isdigit():
if year > 0:
correctcheck = "3"
else:
print "You Did Not Enter A Valid Year"
errormsg = "1"
break
else:
print "You Did Not Enter A Valid Year"
errormsg = "1"
break
if correctcheck == "3":
COUNT_help.months(months = month)
print month
print months
SCRIPT 2:無論如何,我呼籲利用腳本(1)
SCRIPT 1(與去年LINE COUNT_help.months()問題的一個參數(2)腳本函數時收到以下錯誤:
jan = 1
feb = 32
mar = 60
apr = 91
may = 121
jun = 152
jul = 182
aug = 213
sep = 244
obr = 274
nov = 305
dec = 335
def months(months = ""):
if months == "1":
months = jan
return months
if months == "2":
months = feb
return months
if months == "3":
months = mar
return months
if months == "4":
months = apr
return months
if months == "5":
months = may
return months
if months == "6":
months = jun
return months
if months == "7":
months = jul
return months
if months == "8":
months = aug
return months
if months == "9":
months = sep
return months
if months == "10":
months = obr
return months
if months == "11":
months = nov
return months
if months == "12":
months = dec
return months
和什麼問題?你的文件又如何連接?進口聲明在哪裏? – SilentGhost 2010-11-02 17:42:59
回溯(最近通話最後一個): 文件 「C:\用戶\奧馬爾\桌面\ COUNT.py」 60行,在 COUNT_help.months(月=月) AttributeError的: '模塊' 對象有沒有屬性'months' –
DonJuma
2010-11-02 17:47:10
你是如何導入第二個腳本的? – user225312 2010-11-02 17:47:56