文字去掉空格,换行

一、去除空格,换行

"  xyz  ".strip()      # returns "xyz" 
"  xyz  ".lstrip()      # returns "xyz  " 
"  xyz  ".rstrip()      # returns "  xyz" 
" x y z ".replace(' ', '')  # returns "xyz" 
"x
y
z".replace("\n", ""),去掉换行

猜你喜欢

转载自blog.csdn.net/qq_37884273/article/details/81591495