#! /usr/bin/env python
#
#
# This code splits a document into two parts, a header part and a body part.
# The split is done at the first empty line, example:
#
####### Start example document
# This is the header part, this is the header part, this
# is the header part, this is the header part, this is
# the header part
#
# This is the body part, this is the body part, this is
# the body part, this is the body part, this is the body
# part
####### End example document
def splitDocument( documentString ):
pos = documentString.find('\n\n')
return (documentString[:pos],documentString[pos+2:])
if __name__ == '__main__':
demoString = """first line
second line
third line
fifth line
sixth line"""
print splitDocument( demoString )
#
#
# This code splits a document into two parts, a header part and a body part.
# The split is done at the first empty line, example:
#
####### Start example document
# This is the header part, this is the header part, this
# is the header part, this is the header part, this is
# the header part
#
# This is the body part, this is the body part, this is
# the body part, this is the body part, this is the body
# part
####### End example document
def splitDocument( documentString ):
pos = documentString.find('\n\n')
return (documentString[:pos],documentString[pos+2:])
if __name__ == '__main__':
demoString = """first line
second line
third line
fifth line
sixth line"""
print splitDocument( demoString )