删除
从python字符串 [英] Remove 
 from python string

查看:196
本文介绍了删除
从python字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您通过Python中的popen运行某些操作时,结果从缓冲区输入,每行的末尾带有回车符(13)的CR-LF十进制值.如何从Python字符串中删除它?

When you run something through popen in Python, the results come in from the buffer with the CR-LF decimal value of a carriage return (13) at the end of each line. How do you remove this from a Python string?

推荐答案

您可以轻松完成

s = s.replace('\r\n', '\n')

将所有出现的CRNL替换为NL,这似乎是您想要的.

to replace all occurrences of CRNL with just NL, which seems to be what you want.

这篇关于删除
从python字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆