Python: Print only the message on warnings -
I am issuing many warnings in a verifier, and I want to suppress everything in stdout except the message Warnings. Warn ()
. , now I'm looking at it:
./ file.py:123: user warning: my
I would like to see: < / P> Edit 2: Overriding warnings.showwarning ()
went to work:
def _warning (message, category = user Warning, file name = '', linin = -1): print (messages) ... warnings.shovaling = _warning warnings.warn ('foo')
< Div class = "post-text" itemprop = "text">
Monkey patches with their own custom function
Comments
Post a Comment