Explain split(), sub(), subn() methods of “re” module in Python?
These methods belong to the Python RegEx or ‘re’ module and are used to modify strings.
👉split(): This method is used to split a given string into a list.
👉sub(): This method is used to find a substring where a regex pattern matches, and then it replaces the matched substring with a different string.
👉subn(): This method is similar to the sub() method, but it returns the new string, along with the number of replacements.
Share and Support
@Python_Codes
>>Click here to continue<<