- # 单行字符串 rstrip()
- strvar = strvar.rstrip()
- # 多行
- strlist = [l.strip for l in strlist]
- #文件处理
- filelines = [l.rstrip() for l in open(filename)]
- #该片段来自于http://www.codesnippet.cn/detail/221020136561.html
来源: http://www.codesnippet.cn/detail/221020136561.html