mardi 12 octobre 2021

Replace 2% in string

I would like to replace %2 by + in my string. I try to use re.sub but I didn't find a solution.

Input:

import re; 
import urllib

input_file = re.sub("\%20\{2}", '+', urllib.parse.quote("Charts Instrument's Rating+Movment"))
input_file

Outpout :

Charts+Instrument%27s+Rating+Movment

Do you have an idea ?

Aucun commentaire:

Enregistrer un commentaire