Update filter.py

some tips:
# string - int transfer
# logical flaws