str=" a b c de
f "
print(str.replace(" ","").replace("\n",""))
===输出结果===
abcdef
str = " a b c " str.strip() 'a b c'
str = " a b c " str.lstrip() 'a b c '
str = " a b c " str.lstrip() ' a b c'
str = " a b c " str.lstrip() 'abc'
以上就是python实现去除空格及tab换行符的方法的详细内容,更多关于python去空格tab换行符的资料请关注其它相关文章!