# Delete Zeroes from list of list [closed]

I know how to delete zeros from a simple list, but I have a list like the following:

list11 ={{2,4,0,0,0},{3,0,0,0,0},{9,4,3,0,0}}


How do I delete the zeros from this and create a list like the following:

{{2,4},{3},{9,4,3}}

Is this even possible since they have different lengths?

## closed as off-topic by Yves Klett, corey979, Feyre, m_goldberg, MarcoBDec 5 '16 at 1:12

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Yves Klett, corey979, Feyre, m_goldberg, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

• Have you seen DeleteCases? You need the levelspec syntax. – Edmund Oct 5 '16 at 1:02
• You can also do it like this: DeleteCases[{{2, 4, 0, 0, 0}, {3, 0, 0, 0, 0}, {9, 4, 3, 0, 0}, {2, 4, 0, 0, 0}, {3, 0, 0, 0, 0}, {9, 4, 3, 0, 0}, {2, 4, 0, 0, 0}, {3, 0, 0, 0, 0}, {9, 4, 3, 0, 0}, {2, 4, 0, 0, 0}, {3, 0, 0, 0, 0}, {9, 4, 3, 0, 0}, {2, 4, 0, 0, 0}, {3, 0, 0, 0, 0}, {9, 4, 3, 0, 0}, {2, 4, 0, 0, 0}, {3, 0, 0, 0, 0}, {9, 4, 3, 0, 0}, {2, 4, 0, 0, 0}, {3, 0, 0, 0, 0}, {9, 4, 3, 0, 0}}, 0, {-1}] – Moo Oct 5 '16 at 1:13
• DeleteCases[lst, 0, Infinity] also seems to work. – Nasser Oct 5 '16 at 1:51
• With v10.2 or later: {{2, 4, 0, 0, 0}, {3, 0, 0, 0, 0}, {9, 4, 3, 0, 0}} /. {0 -> Nothing} – Bob Hanlon Oct 5 '16 at 2:57
• @BobHanlon And in earlier versions you can use Sequence[] instead of Nothing. – wxffles Oct 5 '16 at 3:17

According to the comments of Nasser

DeleteCases[list11, 0, Infinity]


{{2,4},{3},{9,4,3}}

Or instead of deleting the cases you don't want, you can select the cases you do want using UnequalTo:

Select[#, UnequalTo[0]] & /@ list11
{{2, 4}, {3}, {9, 4, 3}}

• I've added a link in your answer because I didn't know and I found it very good – LCarvalho Dec 4 '16 at 19:13