Computer Science, asked by podapanni2003, 2 months ago

how will you delete a string in python​

Answers

Answered by Anonymous
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