简体   繁体   中英

python delete 2 character in string

python search character "x" next step delete this character "x" + character "x" -1 postion in string

Example x="1. 520 2. 529"

I am going to search in x "." and delete "." and number before "." in end I want it look like 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM