What are trailing and leading whitespace? And how can we get rid of them? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

What are trailing and leading whitespace? And how can we get rid of them?

I have found the data whitespaces in Python. I want to see some examples of these whitespace to correctly identify and the way to get rid of them.

9th Aug 2017, 8:31 PM
Sura Wankam
1 Réponse
0
Use functions (methods for string): strip() lstrip() rstrip() (naming is obvious, I guess) for more sophisticated stuff, you need regex.
9th Aug 2017, 8:58 PM
yuri