Hello list.
I use 'configparser' with a 'config.ini' like this:
[Audio]
ATC_STREAM_URL = https://s1-fmt2.liveatc.net/vhhh5 # Hong Kong ATC.
# ...
Some of my code:
import configparser
config = configparser.ConfigParser()
config.read ("config.ini")
ATC_STREAM_URL = config.get ("Audio", "ATC_STREAM_URL", fallback="")
But the trailing comment in 'ATC_STREAM_URL = ..' is NOT removed.
A fix I use instead is to read the whole 'config.ini' myself,
strip the trailing comments and call
'config.read_string (fixed_lines)' instead.
But is there a simple way for all this?
--
--gv
--
https://mail.python.org/mailman3//lists/python-list.python.org