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 Mon Sep 21 15:53:25 2020.

If you see any errors or have comments, please let us know.