Monday, July 6, 2020

What are split() sub() and subn() in python


What are split() sub() and subn() in python

The data structure string is modified with the help of the "re" module in python. In the module, three methods are used. When for modification regex pattern is used to split a given string into a list spilt() is used.

When the method finds all the substrings where the regex pattern matches and then replace them with a different string, the sub() command is used.

The command subn() is similar to sub()  and also returns the new string along with the number of replacements.


SMART SUBU

Author & Editor

Prof. (Dr) Subroto Chowdhury is a Data science and Technology Enthusiast, Independent Research Practitioner, Education Change Motivator, Ethical Investment Advisor and Analytics Consultant.Analytical Exposition interests him as an instrumentation process to make objective understanding of the complex Phenomenon and other decisions. He believes in making education more affordable, easy and pragmatic.

To Know More Click Here