python用BeautifulSoup解析源碼時,去除空格及換行符

1、去除空格python   strip()spa " xyz ".strip() # returns "xyz" " xyz ".lstrip() # returns "xyz " " xyz ".rstrip() # returns " xyz" " x y z ".replace(' ', '') # returns "xyz" 2、替換 replace("space","")code   
相關文章
相關標籤/搜索