try / except not worknig correctly

Jeremy Bowers jerf at jerf.org
Fri Apr 1 16:52:52 EST 2005


On Sat, 12 Mar 2005 17:06:17 -0800,
'@'.join([..join(['fred','dixon']),..join(['gmail','com'])]) wrote:

I'd also suggest

validInput = "ABCDEFGHIJKL" # and there are more clever ways to do this,
                            # but this will do

myInput = raw_input(" ".join(validInput) + "?")
if len(myInput) != 1:
	# do whatever
	pass
if myInput not in validInput:
	raise ValueError("Input not in legal input: " + validInput)


Obviously not a drop-in replacement for your code, but ought to clean it
up a little. 



More information about the Python-list mailing list