def getsaplogonoptions():
import ConfigParser
Config = ConfigParser.ConfigParser()
Config.read("C:\\SAP\saplogon.ini")
def ConfigSectionMap(section):
dict1 = {}
options = Config.options(section)
for option in options:
try:
dict1[option] = Config.get(section, option)
if dict1[option] == -1:
DebugPrint("skip: %s" % option)
except:
print("exception on %s!" % option)
dict1[option] = None
return dict1
loginlist=[]
j=0
Descriptions = ConfigSectionMap("Description")
for i in Descriptions:
try:
tmp=''
name=str('item' + str(j))
j+=1
loginlist.append(Descriptions[name])
except:
j+=1
continue
return loginlist
Note that ConfigParser can be installed via pip install configparser. Documentation for configparser is available here.