2018年10月3日 星期三

Python的空白字元(Whitespace character)

根據python3文件
https://en.wikipedia.org/wiki/Whitespace_character



string.whitespace
A string containing all ASCII characters that are considered whitespace. This includes the characters space, tab, linefeed, return, formfeed, and vertical tab.

characters space  ' '
tab      \t           (\x09) (0x09)
linefeed  \n      (\x0a)  (0x0a)
return      \r      (\x0d) (0x0d)
formfeed   \f    (\x0c) (0x0c)
vertical tab  \v (\x0b)(0x0b)

string method 
strip( )可將前後空白字元都移除
strip(' ')則是將左右的leading跟trailing空白移除








沒有留言:

張貼留言