Input file Test.ini:
;INTEGRITY_PERIOD=300
INTEGRITY_PERIOD=100
Code:
key = None
value = None
with open('hmi.ini', 'r') as inifile:
for line in inifile:
if line.startswith(';INTEGRITY_PERIOD='):
continue;
if line.startswith('INTEGRITY_PERIOD='):
key, value = line.split("=")
break
if value and value.isdigit():
print(value)
else:
print(300)
The above code is always returning 300. Looks like isdigit() is not working or is there anything wrong in my code ?