Answers for "python how to replace whitespaces"

5

remove trailing and leading spaces in python

text = "   Hello World        "
text.strip()
# Hello World
Posted by: Guest on November-08-2020
1

space to underscore python

mystring.replace(" ", "_")
Posted by: Guest on September-24-2020

Code answers related to "python how to replace whitespaces"

Python Answers by Framework

Browse Popular Code Answers by Language