MyString = " Hello. "
MyString.strip()
#output >>>>> 'Hello.'
>>> ' Hello '.strip()
'Hello'
string =' abc '
# After removing leading whitespace
print(string.lstrip());
# Output: 'abc '
# After removing trailing whitespace
print(string.rstrip());
# Output: ' abc'
# After removing all whitespace
print(string.strip());
# Output: 'abc'
my_string.strip()
str_1 = " Hire freelance developers "
print(str_1.strip())
#Output = "Hire freelance developers"
print(str_1.rstrip())
#Output = " Hire freelance developers"
print(str_1.lstrip())
#Output = "Hire freelance developers "
Code Example |
---|
Python :: sum of a numpy array |
Python :: all select first value in column list pandas |
Python :: progress bar python text |
:: null variable in python |
:: |
:: get week from datetime python |
:: how to print specific part of a dictionary in python |
:: |
Python :: |
Python :: |
Python :: duplicate in list |
Python :: how to make a game in python |
Python :: python to run excel macro |
Python :: views.py django |
:: load image metadata with pil |
Python :: replace all characters in a string python |
Python :: |
:: python finally keyword |
:: |
Python :: python open google |
Python :: |
:: python split string keep delimiter |
:: password guessing game python |
Python :: ordered dictionary |
Python :: get a column of a csv python |
:: python file write |
Python :: python lists tuples sets dictionaries |
Python :: render() in django |
Python :: regex for repeating words python |
Python :: np.r_ |