Search code examples
pythonpython-3.xini

How to read { and ( from .ini configs file


i have the below posted password, and it saved in .ini config. file. the following characters are marked or highlighted in red: ( and { how can i be able to read them

here is how i created the .ini file:

config = configparser.ConfigParser()
config.read('configs.ini')

configs.ini:

CLIENT_SECRET = P^L|Tf5x&9_2TIStIM({IdN^hObZ/-v2{KB(3

Solution

  • i found the answer. the encoding type should have been added to the reader as follows:

    config = configparser.ConfigParser()
    config.read('configs.ini', encoding='utf-8')