Extracting data from ython dictionary object (Posting On Python-List Prohibited)

Stanley Denman dallasdisabilityattorney at gmail.com
Fri Feb 9 13:40:35 EST 2018


On Friday, February 9, 2018 at 12:20:29 AM UTC-6, Lawrence D’Oliveiro wrote:
> On Friday, February 9, 2018 at 6:04:48 PM UTC+13, Stanley Denman wrote:
> > {'/Title': '1F:  Progress Notes  Src.:  MILANI, JOHN C Tmt. Dt.:  05/12/2014 - 05/28/2014 (9 pages)', '/Page': IndirectObject(465, 0), '/Type': '/FitB'}
> > 
> > What a want is the following to end up as fields on my Word template merge:
> > MedSourceFirstName: "John"
> > MedSourceLastName: "Milani"
> > MedSourceLastTreatment: "05/28/2014"
> > 
> > If I use keys() on the dictionary I get this:
> > ['/Title', '/Page', '/Type']I was hoping "Src" and Tmt Dt." would be treated
> > as keys.  Seems like the key/value pair of a dictionary would translate
> > nicely to fieldname and fielddata ...
> 
> It would, except that’s not how the information is represented in the PDF file. Looks like what you want is all in the title string. So extracting it will require some string manipulation. Do all the title strings follow the same format? That should simplify the manipulations you need to do.

Thanks you Lawrence for your response. Sounds like I am going to have to dig in to Regex to get at the test I want.



More information about the Python-list mailing list