Stupid question with (for sure) simple answer...
I am using configparser to read some strings from a file. When the string has the '%' symbol ($%& for example) it complains:
ConfigParser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: "%&'"
Anybody familiar with this?
Thanks!
ConfigParser is a Python class which implements a basic configuration language for Python programs. It provides a structure similar to Microsoft Windows INI files. ConfigParser allows to write Python programs which can be customized by end users easily.
configparser comes from Python 3 and as such it works well with Unicode.
A Python configuration file is a pure Python file that populates a configuration object. This configuration object is a Config instance.
Just use a StringIO object and the configparser's write method. It looks like the only method for "printing" the contents of a config object is ConfigParser. write which takes a file-like object. io.
If you don't want environment variable substitution, then use RawConfigParser, not ConfigParser.
Write two %
:
V = ('%%', 'MHz', 'GHz')
result:
('%', 'MHz', 'GHz')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With