python 读取文本文件,删除换行符 的方法 删除每行末尾的换行符有三种方法: (1)str.strip(“ ”):删除首尾的” ” (2)str.replace(“ ”,””):替换” ”为空 (3)str = str[0:-1]:切片去掉末尾,临时性改变,必须赋值