【发布时间】:2015-09-17 09:29:52
【问题描述】:
当我第一次收到“mwindow”时就做对了。但是,如果我做错了一次或多次,即使我最后做对了,我总是会得到“无”。
def windows():
print('\n---Maintenence Window Config---\n')
mwdate = input('Enter the date for the maintenance window (3 letters, Mon, Tue, Wed, etc.) : ')
if len(mwdate) > 3 or len(mwdate) < 3:
print('Error, date must be 3 characters in length.')
windows()
else:
mwstart = input('Enter the time in 24h format for the beginning of the maintenance window (e.x. 04:00): ')
mwend = input('Enter the ending time of the maintenance window in 24h format (e.x. 04:30): ')
if int((mwstart and mwend).replace(':','')) < 1000 and (mwstart and mwend).startswith('0'):
mwindow = mwdate.capitalize()+mwstart+'-'+mwdate.capitalize()+mwend
return mwindow
else:
print('Error, be sure you prefix your window times with a 0 if they are earlier than 10:00.')
windows()
print(windows())
我不相信这是重复的,因为所有其他问题都存在忘记将测试值传回函数的问题,但在我的情况下,这并不适用
【问题讨论】:
标签: python function python-3.x return nonetype