I have this list:
test_results = ['Test1\nTest2', 'Grade A\nGrade B'] I want to split the elements by the '\n' and save them in another list, like this:
test_results = [['Test 1, Grade A'], ['Test B', 'Grade B']] I am struggling to find a way to do it... can you help me?
test_results = [i.split('\n') for i in test_results]would be a starting point. You also probably want to look atzipfor rotating the resulting list of lists.