Error Trapping In Python

Jonathon jblake at eskimo.com
Wed Jul 7 19:57:17 EDT 1999


	The script I am writing expects the user to input an
	integer.   Being on the safe side, it reads the raw
	data as a string.   However, to convert that string
	to an integer, is perplexing me.

	string.atoi.(read_data) will give a value error if
	read_data contains something other than a number.

	int ( read_data ) gives a Value Error, if non numerical
	data is included.  <<  Or even if 10.0 is written instead
	of 10  >>

	Somewhere, in that vast documentation of Python, I thought
	I read a solution. Can somebody point me to where I meant
	have read it.  << Searching python.org, for "error trapping"
	and "integer" resulted in a nice essay on mathematical languages.
	"Error trapping" alone served out over 600 examples, none of 
	which, from the synopsis, seemed relevent.

	xan

	jonathon

	

-- 
	I'm still looking for a good book on
		3:	The Recent Unpleasantness
		1:	The War Of Northern Aggression.
		2:	The War of Southern Rebellion.




More information about the Python-list mailing list