As a follow up to this question: split elements of a list in python
Given the list:
l = ['element1\t0238.94', 'element2\t2.3904', 'element3\t0139847', '']
How do I get everything after the \t
?
I tried:
>>> [i.split('\t', 1)[1] for i in t]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
Is it because I have ''
at the end? How do I exclude it?