try:
    do_something()
except:
    pass

You will use the pass statement.

The pass statement does nothing. It can be used when a statement is required syntactically but the program requires no action.

Answer from Andy on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 72298793 › is-it-okay-to-leave-except-empty-when-i-print-out-trackback-anyway-python-3-1
Is it okay to leave except EMPTY, when I print out trackback anyway? [Python 3.10] - Stack Overflow
I understand that it's usually not a good idea to leave "except" empty as errors will go unnoticed. For example: def test4(): try: 0/0 except: pass print('PROG...
🌐
CodeQL
codeql.github.com › codeql-query-help › python › py-empty-except
Empty except — CodeQL query help documentation
An empty except block may be an indication that the programmer intended to handle the exception, but never wrote the code to do so. Ensure all exceptions are handled correctly. In this example, the program keeps running with the same privileges if it fails to drop to lower privileges.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 72007659 › how-do-i-avoid-except-returning-an-empty-object-class
python - How do I avoid except returning an empty object class - Stack Overflow
April 26, 2022 - @DavidMontoyaGonzález Well, it ... would be except InputError: rm = None. So rather than creating an "empty" object, create a null object....
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 381248 › using-try-except-to-catch-a-blank-input
python - Using Try, Except to catch a blank input [SOLVED] | DaniWeb
In python 3, after result = input(prompt) , result is a string in the python sense (an instance of the datatype 'str'). Examples of strings are · "" # the empty string " " # a string of white space "3.14159" # a string with the representation … — Gribouillis 1,391 Jump to Post · You can pass the acceptable values to the checkInput() function and let it do the work. For the getFloat() function, use a try/except to test for correct input.
🌐
University of Toronto
teach.cs.toronto.edu › ~csc148h › winter › notes › abstract-data-types › exceptions.html
3.3 Exceptions
We can achieve this very easily in Python: we define our own type of error by making a subclass of a built-in class called Exception. For example, here’s how to define our own kind of Exception called EmptyStackError: class EmptyStackError(Exception): """Exception raised when calling pop on an empty stack.""" pass
🌐
Java2s
java2s.com › example › python-book › catching-all-the-empty-except-and-exception.html
Python - Catching all: The empty except and Exception
try: action() except NameError: ... # Handle NameError except IndexError: ... # Handle IndexError except: ... # Handle all other exceptions else: ... # Handle the no-exception case · The empty except clause is a sort of wildcard feature.
🌐
Derscanner
derscanner.com › vulnerability-database › Python-:-Error-handling:-empty-except-block
DerScanner Vulnerability Database: Python : Error handling: empty except block
The application contains an empty catch block, i.e. it catches an exception but does not handle it. Exception catch without its handling makes it more difficult to diagnose an error and correct it. Ignoring exceptions and other error conditions may allow an attacker to induce unexpected behavior ...