Definition:
Back to the main index of this glossary
>>> import re
>>> x = '\nBeneath the wide and starry sky, \nDig the grave and let me lie, \nGlad did I live and gladly die, \nAnd I lay me down with a will:\n\nThis be the verse you grave for me: \nHere he lies where he longed to be, \nHome is the sailor, home from sea, \nAnd the hunter home from the hill.\n\n-- "Requiem" by Robert Louis Stevenson\n\n'
>>> print x
Beneath the wide and starry sky,
Dig the grave and let me lie,
Glad did I live and gladly die,
And I lay me down with a will:
This be the verse you grave for me:
Here he lies where he longed to be,
Home is the sailor, home from sea,
And the hunter home from the hill.
-- "Requiem" by Robert Louis Stevenson
>>> y = re.compile('\n[BDGATH]')
>>> z = re.split(y,x)
>>> for item in z:
... print item
...
eneath the wide and starry sky,
ig the grave and let me lie,
lad did I live and gladly die,
nd I lay me down with a will:
his be the verse you grave for me:
ere he lies where he longed to be,
ome is the sailor, home from sea,
nd the hunter home from the hill.
-- "Requiem" by Robert Louis Stevenson
Back to the main index of this glossary
