Strip method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Strip method

what exactly input().strip() does ??

22nd Jun 2017, 4:45 PM
Rajkamal A V K
Rajkamal A V K - avatar
3 Answers
+ 3
sorry :/, input().strip() removes white space from the beginning or end of a string. "_hello_" the _ will be removed and the out put will be hello without the spaces each side..... hope that helps
22nd Jun 2017, 4:56 PM
D_Stark
D_Stark - avatar
+ 1
@David stop making random comments of promoting ur code there is code section for it.. or if u r so much eager to show then post a question in QA section as a new thread.. else u will be reported and downvoted
22nd Jun 2017, 4:52 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
If you write input().strip("a") it will removes the eventualy first(s) or last(s) "a". I say this because many people think strip is limited to spaces.
22nd Jun 2017, 7:51 PM
clement
clement - avatar