What are delimiters in python....?
Answers
A delimiter is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data streams.[1] An example of a delimiter is the comma character, which acts as a field delimiter in a sequence of comma-separated values. Another example of a delimiter is the time gap used to separate letters and words in the transmission of Morse code.
Almost all the special character serves as a delimiter in python. For eg. “*, /, &, (, ), { , }, \, |” etc are some of the delimiters used in python. Let us work with an example to understand better.
content = “An apple a day keeps the doctor away”
print(content);
This would provide an output like below:
An apple a day keeps the doctor away”
import re
content =”An apple * a day keeps\ the doctor away”.
print(re.split(‘*\’, content))
The output will be,
‘An apple’ ‘a day keeps’ ‘doctor away’