Name

.strip()

Examples
a = '              ...here...             '
# If no arguments are given strip() removes leading and trailing whitespace.
a = a.strip()
print(a)             # Prints '...here...'
aNoDots = a.strip('.') # Removes leading and trailing instances of '.'.
print(aNoDots)       # Prints 'here'
Description Retruns a copy of the string with leading and trailing characters removed -- whitespace by default. Given an optional argument, strip removes specific leading and trailing characters.
Syntax
a.strip()
a.strip(chars)
Parameters
charsan optional argument that removes specific characters
Related string
String Formatting
.find()
.join()
.split()
.replace()
Updated on Tue Jul 11 06:52:24 2017.
Creative Commons License