Which method is used to remove leading and trailing whitespace from a string in Python?
-
A
trim()
-
B
strip()
Correct answer
-
C
clean()
-
D
remove()
Correct answer
B. strip()
14 views
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