Checking for Errors
<p>How do I set a value to <strong>only accept certain data in Python</strong>? Like I am making a code for a colour identifier. I want my variable to only accept up to <code>FFFFFF</code> any nothing greater than that. The base-16 characters pretty much...<strong>hex code</strong>.</p>

<p>The reason I am trying to do this is because if a user enters in a value like <code>GGGGGG</code> it will give them a <strong>Script Error</strong>, which actually makes me look incompetent (which I might be, but I do not want to look like I am). And also, if they enter in special characters like F1F2G% it will mess up too. In addition, if they leave the box blank, it also gives a Script Error.</p>

<p>I want to avoid those errors. Does anyone know of a good way?</p>
