[英]python delete 2 character in string
python search character "x" next step delete this character "x" + character "x" -1 postion in string python搜索字符“ x”下一步在字符串中删除此字符“ x” +字符“ x” -1
Example x="1. 520 2. 529"
I am going to search in x
"." 我要搜索x
“。” and delete "." 并删除“。” and number before "." 和“。”之前的数字。 in end I want it look like x=" 520 529"
最后,我希望它看起来像x=" 520 529"
Before I created this topic I only find replace one character for one character 在创建本主题之前,我只发现一个字符替换一个字符
import re
re.sub(r'(.\.)', '', a)
Where a
is the string you want to replace in. 其中a
是您要替换的字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.