I have the text "languageType" : "en",  and I want to replace it with en. How do I do it using replace? I've tried this so far so it's not working
lang = s.split(":")[0].replace("[\"']", "", -1).strip()
print(lang)
But I keep getting "en"
I have the text "languageType" : "en",  and I want to replace it with en. How do I do it using replace? I've tried this so far so it's not working
lang = s.split(":")[0].replace("[\"']", "", -1).strip()
print(lang)
But I keep getting "en"
The replace method doesn't accept a regular expression, but rather a string. To replace with a regex use re.sub(). See How to input a regex in string.replace?
I've made the same mistake before, myself.