What is the best way to convert a string on the format
"1-2-3-4" to a list
[1, 2, 3, 4]? The string may also be empty, in which case the conversion should return an empty list
This is what I have:
map(lambda x: int(x), filter(lambda x: x != '', "1-2-3-4".split('-')))
EDIT: Sorry all of those who answered before I corrected my question, it was unclear for the first minute or so.