The task is as follows: if in the config.ini
file and in the global variable are not the same, replace the value with the value of the global variable, if they are the same, output the message.
python script
config = ConfigParser.RawConfigParser() version = 10 def test2(): global version config.read('config.ini') old_config = config.getint('INFO', 'version') if old_config != version: config.set('INFO', 'version', '%d') % version else: print 'not delete' return 'done'
config.ini
[INFO] version = 11
with this code I get an error
TypeError: unsupported operand type(s) for %: 'NoneType' and 'int'