1. Home
  2. Data Science
  3. Python
  4. Which method is used to remove leading and trailing…

Added 4 May 2024

Which method is used to remove leading and trailing whitespace from a string in Python?

  1. trim()
  2. strip() Correct answer
  3. clean()
  4. remove()

Correct answer

B. strip()

14 views

MCQSEXAM

Explanation

 The strip() method removes leading and trailing whitespace from a string.

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs