Answers for "how to print error"

14

python exception

try:
  # code block
except ValueError as ve:
  print(ve)
Posted by: Guest on March-31-2020
0

python print error output

print("spam", file=sys.stderr)
Posted by: Guest on July-20-2021
0

try except python

def sum_of(x, y):
  try:
    print(x + y)
  except TypeError:
    print("Invalid argument specified.")
Posted by: Guest on September-25-2020

Python Answers by Framework

Browse Popular Code Answers by Language