我遇到了返回月份和日期变量以在其他函数中使用的问题。
def date():
date = raw_input("Date (ex. Jun 19): ")
date = date.split(' ')
month = date[0]
month = month[:3].title()
day = date[1]
return (month, day)
def clone(month,day):
print month day
这是脚本的输出:
Date (ex. Jun 19): june 19
Traceback (most recent call last):
File "./manualVirt.py", line 26, in <module>
main()
File "./manualVirt.py", line 12, in main
clone(agent,month,day)
NameError: global name 'month' is not defined