niedziela, 8 września 2013

error maping

#!/usr/bin/python3

while True:
        try:
                x = int(input("Enter number: "))
                break
        except ValueError as error:
                print ("ooops", error)


result:

marek@mbo:~/Dokumenty$ ./true.py 
Enter number: f
ooops invalid literal for int() with base 10: 'f'

Brak komentarzy:

Prześlij komentarz