[Tutor] ASCII Conversion
David Kidd
davekidd at gmail.com
Tue Jan 31 06:25:54 CET 2012
On Tue, Jan 31, 2012 at 15:50, Michael Lewis <mjolewis at gmail.com> wrote:
> ... However, if I pass in a string, it's converted to ASCII and will
> still satisfy the if statement and print out value. How do I ensure that a
> string is caught as a ValueError instead of being converted?
It depends on what you want to do if you catch a string. If you just
want to end the function, you could just try returning on the
exception, rather than passing. This will stop the string from being
processed any further.
More information about the Tutor
mailing list