\n
isn't treated specially when a config file is read by a ConfigParser
, it's interpreted as a litreral \n
.
If you want a newline, just continue the option string on the next line:
[NOTIFICATIONS]
test1 = Hello,
{username}!
Each line starting with whitespace is treated as continuation of the previous line, the whitespace will be removed, but the newline stays:
>>> print(cfg.get('NOTIFICATIONS', 'test1'))
Hello,
{username}!
>>>