Is it possible to define input times, like time, date, currency or that should be verified manually? Like for example:
morning = input('Enter morning Time:')
evening = input('Enter evening Time:')
.. I need (only) time here, how do I make sure that user enters input in xx:xx format where xx are integers only.
input(in Python 2.any) will return the type of whatever expression the user types in. Better (in Python 2.any) is to useraw_input, which returns a string, and do the conversion yourself, catching theTypeErrorif the conversion fails.Python 3.any’s
inputworks like 2.any’sraw_input, i.e., it returns a string.