My input file is one sentence per line. Let’s say it looks like:
A
B
C
D
E
F
Desired output is:
::NewPage::
A
B
::NewPage::
C
D
::NewPage::
E
F
I know that I should be using a while loop but not sure how to?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t need a
whileloop here – look at thegrouperrecipe initertools.Note that you will need a slightly different version if you are using 2.x.
E.g:
Which produces:
If you need
Nonevalues, you can use a sentinel object.