How to remove spaces in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to remove spaces in Python?

29th Oct 2018, 10:44 AM
Abdul S Ansari
Abdul S Ansari - avatar
3 Answers
31st Oct 2018, 8:17 AM
David Ashton
David Ashton - avatar
+ 3
If you just want to remove every space from a string, this is probably simplest: string = string.replace(' ', '') If it's a bit more complicated than that - see what 1704086_ibnul said. ;-)
29th Oct 2018, 12:01 PM
HonFu
HonFu - avatar