my problem is:
I have a list which, after numerous cleanup, features elements which looks like '455XYZ455'. I'm trying to remove everything after X, but it is inside a list. The code that allows me to do this is the following:
check = [re.sub(r'\W', '', i) for i in content]
# print(check)
check2 = [re.sub('[aclassnewpagehref]', '', i) for i in check]
# print(check2)
check3 = [re.sub('[/<=""]', '', i) for i in check2]
# print(check3)
check4 = [item for item in check3 if item != '']
print(check4)
As expected it gives me just like above, a lot of '455XYZ455'. I just want the '455', but this is a list. Being a complete beginner in Python, I am entirely stuck. Thank you for reading and perhaps helping me!