Explain split(), sub(), subn() methods of “re” module in Python.

By ayush goel in 22 Sep 2023 | 04:08 pm
ayush goel

ayush goel

Student
Posts: 346
Member since: 21 Sep 2023

Explain split(), sub(), subn() methods of “re” module in Python.

22 Sep 2023 | 04:08 pm
0 Likes
divas goyal

divas goyal

Student
Posts: 453
Member since: 22 Sep 2023

split(), sub(), and subn() Methods of the re Module:

  • split(): Splits a string into a list of substrings based on a regular expression pattern.
  • sub(): Replaces occurrences of a pattern in a string with a specified replacement.
  • subn(): Similar to sub(), but also returns the number of substitutions made.
22 Sep 2023 | 06:37 pm
0 Likes

Report

Please describe about the report short and clearly.