I just started learning my first real programming language, Python. I'd like to know how to constrain user input in a raw_input
to certain characters and to a certain length. For example, I'd like to show an error message if the user inputs a string that contains anything except the letters a-z
, and I'd like to show one of the user inputs more than 15 characters.
The first one seems like something I could do with regular expressions, which I know a little of because I've used them in Javascript things, but I'm not sure how to use them in Python. The second one, I'm not sure how to approach it. Can anyone help?