Given the following text:
input_value= """12
23
54"""
I want to return lists with the first and second elements of each line:
[[1,2,5], [2,3,4]]
I am trying to achieve this using a one-liner but struggling to access the correct indexes of each line and then placing them into a separate list. The number of returned lists should be equal to the number of digits present on each line:
I've tried the following as a base but clearly requires more logic in order to retrieve the correct digits:
new_list = [[elem] for elem in input_value.split('\n')]