I want to split a string by remove everything expect alphabetical characters.
By default, split
only splits by whitespace between words. But I want to split by everything expect alphabetical characters. How can I add multiple delimiter to split
?
For example:
word1 = input().lower().split()
# if you input " has 15 science@and^engineering--departments, affiliated centers, Bandar Abbas&&and Mahshahr."
#the result will be ['has', '15', 'science@and^engineering--departments,', 'affiliated', 'centers,', 'bandar', 'abbas&&and', 'mahshahr.']
But I am looking for this kind of result:
['has', '15', 'science', 'and', 'engineering', 'departments', 'affiliated', 'centers', 'bandar', 'abbas', 'and', 'mahshahr']