User input masks - Access Style

flebber flebber.crue at gmail.com
Sun Dec 26 23:37:57 EST 2010


Is there anyay to use input masks in python? Similar to the function
found in access where a users input is limited to a type, length and
format.

So in my case I want to ensure that numbers are saved in a basic
format.
1) Currency so input limited to 000.00 eg 1.00, 2.50, 13.80 etc

For sports times that is time duration not a system or date times
should I assume that I would need to calculate a user input to a
decimal number and then recalculate it to present it to user?

So an example, sorry.

import time #not sure if this is any use
minute = input("How many minutes: ")
seconds = input("How many seconds: ")
Hundredths = input("how many Hundredths: ")

# convert user input
MyTime = (minute/60)+(seconds)+(Hundredths/1800)
#Display to user assuming i had written a name and user
# had retrieved it
print("[User], your time was"), (MyTime/60:MyTime(MyTime-((MyTime/
60)*60).(MyTime-(MyTime>0))) )






More information about the Python-list mailing list