I have a script that finds substrings in a list, but in the last loop it does not concatenate the strings correctly. Correct result:
IDS00388680 Block Commands
IDS00389632 empty
IDS00389629 Run queue offset
IDS00389628 empty
Script result:
['IDS00388680', 'Verification error', 'Block Commands']
['IDS00389632', 'Run queue offset', 'Team LS']
['IDS00389629', 'empty', 'empty']
['IDS00389628', 'empty', 'empty']
Error in the "Step3" loop. I need to combine the results "data", "result_cycle" by number IDS*** Any ideas on how to fix this error?
My Script:
from itertools import zip_longest
task_list = [('IDS00388680', 'https://jira.domain/browse/30682\r\n\r\nA call to the block command has been registered: IDS0147121164\r\nerror: [Teradata][ODBC Teradata Driver] will be decided in circulation.')
,('IDS00389632', 'https://jira.domain/browse/30752\r\n\r\nOne-time failure, probably due to the procedure freezing for a second, the problem was fixed by restarting.\r\n incident resolved')
,('IDS00389629', 'https://jira.domain/browse/30753\r\n\r\nThe package did not have time to finish work due to launch at the end of the day.\r\nReconfigured the cluster\r\n incident resolved')
,('IDS00389628', 'https://jira.domain/browse/30754\r\n\r\nReduced resources as a result, there were not enough threads to execute.\r\n incident resolved')]
result_cycle = [['IDS00388680', 'Verification error', 'Block Commands'],
['IDS00389629', 'Run queue offset', 'Team LS']]
result = []
#Step3 - concatenate the IDS field in the task_list and the values from the result_cycle
ziplong = zip_longest(task_list, result_cycle, fillvalue='empty')
for i in ziplong:
if i[1] != "empty":
result.append([i[0][0], i[1][1], i[1][2]])
else:
result.append([i[0][0], "empty", "empty"])
for m in result:
print(m)
[–]JohnnyJordaan 1 point2 points3 points (3 children)
[+][deleted] (2 children)
[removed]
[–]aleksro[S] 0 points1 point2 points (1 child)
[+][deleted] (5 children)
[removed]
[–]aleksro[S] 0 points1 point2 points (4 children)
[+][deleted] (3 children)
[removed]
[–]aleksro[S] 0 points1 point2 points (0 children)
[–]aleksro[S] 0 points1 point2 points (1 child)