Nov-24-2019, 03:37 PM
I have a list which is in the following format:
list = ['A -> B', 'C -> D', 'E -> F']
I am trying to find a way to produce a list of single entries in the following format:
['A','B','C','D','E','F']
When I incorrectly attempt to split by using;
[['A','B], ['C','D'], ['E','F']]
Any help and advice would be greatly appreciated.
list = ['A -> B', 'C -> D', 'E -> F']
I am trying to find a way to produce a list of single entries in the following format:
['A','B','C','D','E','F']
When I incorrectly attempt to split by using;
newList = [] for item in list: newList.append(item.split('->')) print(newList)This incorrectly produces:
[['A','B], ['C','D'], ['E','F']]
Any help and advice would be greatly appreciated.