warnings.simplefilter()
warnings.simplefilter() is a Python function in the Warnings Module category. A simple filter that applies to all warnings. The syntax is warnings.simplefilter(action, category=Warning, lineno=0, append=False). Returns: None. A typical example: warnings.simplefilter("always") # Show all warnings. A close sibling is warnings.warn(), which issues a warning message. Can be controlled with filterwarnings. A close sibling is warnings.filterwarnings(), which adds a warning filter to control which warnings are shown or ignored. A close sibling is warnings.resetwarnings(), which removes all warning filters and restores default behavior. A close sibling is warnings.catch_warnings(), which a context manager that temporarily controls warnings. More about this category: Warning control — warn, filterwarnings, resetwarnings. Related Warnings Module entries: warnings.warn(), warnings.filterwarnings(), warnings.resetwarnings(), warnings.catch_warnings(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try warnings.simplefilter() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.