def is_hex(word):
word= word.lower()
for i in range(len(word)):
if not( word[i].startswith('0x') or word[i].isdigit() or word[i] in ['a','b','c','d','e','f']):
return False
return True
def is_not_num(x):
return not( len(x) > 0 and (x.isnumeric() or x[0].isdigit() or is_hex(x)) )
res = filter(is_not_num, str.split()) # 返回的是迭代器,list(res)
res = ''.join(filter(is_not_num, str.split()))