I want to remove 0 only from my list:
0
>>> mylist = [0, 1, None, 2, False, 1, 0]
You can check for data type of x also and then use != operator.
x
!=
# works for integer 0 [x for x in mylist if type(x) != int or x != 0] # works for float 0.0 as well [x for x in mylist if (type(x) != int and type(x) != float) or x != 0]