136 viewsJune 1, 2023Python#python 0 Monisha M1.03K June 1, 2023 1 Comment Explain the split(), sub(), and subn() methods of the Python “re” module. Monisha M Posted new comment June 1, 2023 Monisha M commented June 1, 2023 Python’s “re” module provides three ways for modifying strings. They are as follows: split() “splits” a string into a list using a regex pattern. sub() finds all substrings that match the regex pattern given by us. Then it replaces that substring with the string provided. subn() is analogous to sub() in that it gives the new string and the number of replacements. 0 Answers ActiveVotedNewestOldest Register or Login
Python’s “re” module provides three ways for modifying strings. They are as follows:
split() “splits” a string into a list using a regex pattern.
sub() finds all substrings that match the regex pattern given by us. Then it replaces that substring with the string provided.
subn() is analogous to sub() in that it gives the new string and the number of replacements.