Python Forum

Full Version: Parsing Text File
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to figure out how to parse some text from a text file and store the results as ordered pairs for a Word document. Using PyPDF2, print(pdfReader.outlines), I can get a listing of the bookmarks. Each bookmark bares a medical record source and a date range for the medical records in the bookmark. I want to create a Word document merge to order medical records from the source AFTER the date range listed in the bookmark and to the present. Here's an example of the sting I want to parse:

{'/Title': '3F: Hospital Records (HOSPITAL) Src.: Parkland Memorial Hospital Tmt. Dt.: 06/11/2015 - 06/14/2015 (27 pages)', '/Type': '/FitB', '/Page': IndirectObject(1264, 0)}

So for this string I want to Pull the name "Parkland Memorial Hospital" and the last date (6/14/2015) To make it a little more trick my target text will be numberF. And the target text is just after the FIRST appearance of the numberF in the text file. So for Exhibit 1F, my target text is just after the first appearance of 1F, and so on. I am new to this and really struggling. Thanks so much.