import redata = ['abc123','abc*123&','Abc123','ABC@*&123','123*Abc']cleaned = [re.sub('\W', '', item) for item in data]print(cleaned)
Standard input is empty
['abc123', 'abc123', 'Abc123', 'ABC123', '123Abc']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!