python strip()

string.strip()

string.strip(s[, chars]) 
Return a copy of the string with leading and trailing characters removed. If chars is omitted or None, whitespace characters are removed. If given and not None, chars must be a string; the characters in the string will be stripped from the both ends of the string this method is called on.

Changed in version 2.2.3: The chars parameter was added. The chars parameter cannot be passed in earlier 2.2 versions.

去除两边的空格,类似PHP的trim()

你可能感兴趣的:(python strip())