Nov-09-2022, 12:52 PM
Hello,
I have a function that read data after a I split the message , and sometime I get wrong message-- which lead to wrong data input
I want to add to it exception , so in the main code I will see this problem and do what I want to do with this information
I have a function that read data after a I split the message , and sometime I get wrong message-- which lead to wrong data input
I want to add to it exception , so in the main code I will see this problem and do what I want to do with this information
def splitingData(msg): data = msg.split('!') lng = len(data) i = 0 for d in data: print(str(i) + ' : ' + d) i += 1 if lng < 10: raise Exception('Missing data!') ----> is this correct? else: pass main(): try: splitingData(MyTestData) exception (what I need to do here?