To replace a string in Python using regex(regular expression), use the regex sub() method . The re. sub() is a built-in Python method that accepts five arguments maximum and returns replaced string. You can also use the str.
To replace a string in Python using regex(regular expression), use the regex sub() method . The re. sub() is a built-in Python method that accepts five arguments maximum and returns replaced string. You can also use the str.