Never use list as a name. You overwrite built-in datatype list.
You should use 'extend' instead of 'append':
You should use 'extend' instead of 'append':
>>> lst = ['A -> B', 'C -> D', 'E -> F'] >>> new_list = [] >>> for item in lst: ... new_list.extend(item.split(' -> ')) ... >>> new_list ['A', 'B', 'C', 'D', 'E', 'F']
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.