pythontry-catchtry-except

How can use Try/Catch in Python


I want use try...catch in Python but Python give me an error what's can I do?

try:
    input('enter your number');
catch:
    print('please give integer');

Solution

  • try/catch in python is try/except.

    you can use try/except like this:

    try:
       input('enter your number');
    except expression:
       print('please give integer');