python strip char from string code example
Example 1: remove from string python
"Str*ing With Chars I! don't want".replace('!','').replace('*','')
Example 2: python strip characters
string = " python strip method test "
print(string)
print(string.strip())
print(string.strip(' strip'))
Output:
python strip method test
python strip method test
python method test
Example 3: python remove letters from string
string = "abc123"
''.join(char for char in string if char.isdigit())
import re
re.sub("[^0-9]", "", string)