title: How to Split Structured Text Into Separate Lists (Python)
body: <p>I have a raw text (.txt file output from <strong>Tesseract</strong>) in the form:</p>
  <pre><code>[generic question number which is not relevant]  
  [question text question text question text question text question text question text question text question text question text question text ]  
  [answer]  
  [answer]  
  [@ answer]    // true answer designated by @  
  [answer]  
  
  [garbage chars here sometimes, sometimes not]  
  [garbage chars here sometimes, sometimes not]  
  </code></pre>
  <p>...and then this upper structure repeats hundreds of times for different questions.</p>
  <p>What I need is to make an excel column of just questions on one sheet and also on the other sheet answers in the order given (in the order corresponding to their questions), with another column on the same sheet specifying which answer is true (Y) while false answers are all N.</p>
  <p>Because of those garbage chars, and the fact that questions sometimes have irregular line break, I thought of manually marking the text around the question like this:</p>
  <pre><code>**[one special char]** [question text question text question text... ]\n **[two special chars]**  
  then marking the end of answers like  
  [answer]\n  
  [answer]\n  
  [@ answer]\n   
  [answer]\n  
  **[three special chars]**  
  </code></pre>
  <p>How to parse this most efficiently in the way described?
  Tried with regex, but couldn't make it cut the question / answers only.
  Can it be done with splitting string somehow?</p>
  <p>SAMPLE:</p>
  <pre><code>JAA PPL Question Bank  
  CAAS DB v20.2  
  235  
  The State of licence issue of a JAA PPL may be changed to a new member  
   State providing:  
  @The new member State is the licence holder's normal State of residence or   that full-time employment has been taken by the licence holder in that State.  
  The licence holder has resided in the new member State for at least 31 days.  
  The licence holder intends to follow a course of study in the new member   State lasting at least three months.  
  The new member State has no reasonable grounds for refusing to convert the   licence.  
  22  
  No aircraft or personnel who have endorsed certificates or licences may  
   participate in international navigation:  
  Except with the permission of the State whose territory is entered.  
  @Under any circumstances.  
  Except when a general exemption has been awarded by any ICAO contracting   state.  
  Except when a general exemption has been awarded by the State in which the   aircraft is registered or which issued the licence.  
  3  
  Which right is conferred on contracting states by Article 16 of the ICAO   Convention?  
  The right to search, without unreasonable delay, an aircraft from another   contracting state landing on or departing from its sovereign territory.  
  The right to search an aircraft from another contracting state landing on or   departing from its sovereign territory if it is felt that the aircraft is   carrying unlawful goods or persons being pursued in law.  
  @The right to search an aircraft from another contracting state landing on or   departing from its sovereign territory, given due cause.  
  The right to search, with the permission of the pilot in command, an aircraft   from another contracting state landing on or departing from its sovereign     territory.  
  (. 19  
  44  
  The Rules of the Air applicable to an aircraft registered in one state flying   over another state shall be:  
  Those of the state whose airspace is entered and transited.  
  Those of the state of the visiting aircraft.  
  Those agreed by ICAO contracting states to apply in all contracting states.  
  @Those stipulated by JAA operational procedures.  
  67 344  
  Given  
  JAA PPL Question Bank  
  CAAS DB v20.2  
   the following statements about diesel engines.  
  1) power is regulated by the throttle valve  
  2) there is no throttle valve.  
  3) power is set by the fuel flow.  
  4) thermal efficiency is lower than that for a petrol engine  
  5) diesel fuel is less inflammable than petrol.  
  The combination that regroups all of the correct statements is  
  1.2.3  
  © 235  
  )  
  1,3,5  
  2,4,5  
  </code></pre>
  <p>Merco</p>