简体   繁体   中英

python ConfigParser module

I have the following ini file

[Section]
value=test

When i use the ConfigParser Module :

import ConfigParser
config = ConfigParser.ConfigParser()
config.read('config.ini')
str=config.get('Section', 'value')

if str == 'test':
    print 1

else :
    print 0

it always print 0 could someone help

try

print str

and see what the value is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM