fork download
  1. import re
  2. l = ['python','abc123','@@','!!','12345abc#','hello@','141351351','123abc']
  3. print( ["" if not re.search(r'[^\W\d_]', x) else x for x in l] )
  4. print( ["" if not any(c.isalpha() for c in x) else x for x in l] )
  5.  
Success #stdin #stdout 0.03s 9652KB
stdin
Standard input is empty
stdout
['python', 'abc123', '', '', '12345abc#', 'hello@', '', '123abc']
['python', 'abc123', '', '', '12345abc#', 'hello@', '', '123abc']