Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Compare a string that was read from a config ini file in Python?

$
0
0

I have a config.ini file like this:

[LABEL]NAME = "eventName"

And I am reading it into my python code as shown below. However, when I compare it with the exactly the same string, the result is False. I wonder if I should use a different way to read this or I need to do something else?

import configparserconfig = configparser.ConfigParser()config.read('config.ini')my_label_name = config['LABEL']['name']print("My label is: ", my_label_name, " and has type of: ", type(my_label_name))My label is:  "eventName"  and has type of:  <class 'str'>print(my_label_name == "eventName")False

Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>