Does the logging module support f-string? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

Does the logging module support f-string?

format strings in python are really awesome. is it possible to use them in the ''format" keyword argument of the "logging.basicConfig" method? maybe like import logging logging.basicConfig(format=f'...')

28th Jul 2018, 9:43 PM
Romex
Romex - avatar
2 Respostas
+ 3
I've never used it but according to the documentation it doesn't look like it... but it wouldn't hurt to try anyway šŸ™‚ https://docs.python.org/3/library/logging.html#logging.basicConfig "IfĀ formatĀ is specified, use this style for the format string. One of Ā '%', Ā '{'Ā  orĀ  '
#x27; forĀ  printf-style,Ā  str.format()Ā  or string.Template Ā respectively. Defaults toĀ '%'."
28th Jul 2018, 10:10 PM
David Ashton
David Ashton - avatar
+ 1
thanks, I tried it out but got a traceback
30th Jul 2018, 8:29 PM
Romex
Romex - avatar