I am new to this site and new to Python.
So, I learn about regular expressions, and I worked with Google examples
here .
I did one of the "Search" examples, but I changed the "Search" to "Split" and slightly changed the search template to play with it, here is the line
print re.split(r'i', 'piiig')
(note that in the text "piiig" there is 3 'i)
The output has only 2 spaces in which it was split.
['p', '', '', 'gs']
Just wondering why this gives this result. This is not a problem in real life and has nothing to do with it, but I think I can handle it later and want to know what is going on.
Does anyone know what is happening ???
source
share