I have a python program, which gets a value from an XML file and match it with the given code, but I don't know how to print the value with some conditions.
My Python program is:
class setMap(getXml):
def __init__(self, event_log_row):
self.event_log_row = event_log_row
def code(self):
for each in self.event_log_row:
self.get_map(each)
# if I use return here, it basically returns only one value, which is understandable.
def get_map(self, event_code):
dict_class = getXml() # Getting XML from another class
dictionary = dict_class.getdescription()
for keys, values in dictionary.items():
if keys == event_code:
return values
# I'm not allowed to use for loop or any conditions after this
code = ['1011', '1015', '1013']
obj = setMap(code)
print(obj.code())
Is it possible to achieve what I am intend to achieve, can someone give me some suggestions, plz.
Thanks