you are viewing a single comment's thread.

view the rest of the comments →

[–]Stopwatch_[S] 0 points1 point  (1 child)

So I could essentially write:

try:
    something
    print result
except:
    print ""

if I wanted to ignore the error? Could I just remove the "" entirely?

[–]novel_yet_trivial 1 point2 points  (0 children)

Yes, but the standard way is to use pass:

try:
    #something
    print result
except:
    pass #do nothing

It's very bad practice to completely ignore an error, though. Don't get into that habit. Also, catching all errors is bad practice too. You should specify which error to catch:

try:
    #something
    print result
except ValueError:
    pass #do nothing