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   
相关文章
相关标签/搜索