mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
22 lines
No EOL
562 B
Python
22 lines
No EOL
562 B
Python
|
|
|
|
# See https://docs.python.org/3/library/configparser.html
|
|
|
|
import configparser
|
|
|
|
config = configparser.ConfigParser()
|
|
config.read('pyPlc.ini')
|
|
|
|
def getConfigValue(s):
|
|
return config['general'][s]
|
|
|
|
def getConfigValueBool(s):
|
|
return config.getboolean('general', s)
|
|
|
|
if __name__ == "__main__":
|
|
print("Testing configmodule...")
|
|
print(str(config.sections()))
|
|
print(config['general']['mode'])
|
|
for key in config['general']:
|
|
print(key + " has value " + config['general'][key])
|
|
print(config.getboolean('general', 'display_via_serial')) |