how will you delete a string in python
Answers
Answered by
5
Answer:
Python Remove Character from String
- s = 'abc12321cba' print(s.replace('a', ''))
- s = 'abc12321cba' print(s.translate({ord('a'): None}))
- s = 'abc12321cba' print(s.translate({ord(i): None for i in 'abc'}))
- s = ' 1 2 3 4 ' print(s.replace(' ', '')) # 1234 print(s.translate({ord(i): None for i in ' '})) # 1234.
Explanation:
@Ask The MASTER
Similar questions