0
通過更改logging.basicConfig的format
參數將格式化的LogRecord寫入流時,可以將'\n\n'
設置爲終止符嗎?在寫入格式化的LogRecord時將' n n'設置爲終止符
我知道有可能使用terminator
attribute of StreamHandler類來實現這一點,我只是想知道是否可以通過更改format
參數來實現此功能?我不熟悉format
字符串語言
通過更改logging.basicConfig的format
參數將格式化的LogRecord寫入流時,可以將'\n\n'
設置爲終止符嗎?在寫入格式化的LogRecord時將' n n'設置爲終止符
我知道有可能使用terminator
attribute of StreamHandler類來實現這一點,我只是想知道是否可以通過更改format
參數來實現此功能?我不熟悉format
字符串語言
https://docs.python.org/2/library/logging.html#logrecord-attributes解釋這個非常好,你可以這樣做:
"%(filename) %(funcname): %(message)\n\n"
ValueError異常:「?」不支持的格式字符(0xa)在索引10,用python3代碼測試https://bpaste.net/show/dd254217b5da – iMath