1

I have a list of strings. I want to remove those strings that have '\x1b' and '1' in them. my list is called lst. I tried this:

[i for i in lst if j not in ['\x1b', '1'] for j in i]

But it does not work. It says

UnboundLocalError: local variable 'j' referenced before assignment.

How to do it right?

TheFaultInOurStars
  • 3,464
  • 1
  • 8
  • 29
gh1222
  • 657
  • 2
  • 8
  • @AmirhosseinKiani no because it works when there are two strings in condition. but if there are a lot of them , i don't want to write so many and's – gh1222 Mar 20 '22 at 08:42

0 Answers0