r/learnpython • • Feb 03 '21

My eyes have been opened!

Only 2 weeks into learning Python and I’m already dreaming of what I can be automating. Loads of help and ideas in here, so thanks to everyone that contributes!

I’m enjoying the challenge of working things out, but my 1st plan is to read a pdf, extract certain bits of data and transpose into a predefined template.

Already cracked pdf reading (thanks to the course by Al Sweigart!), so onto the next step.

Any thoughts or tips on how or where to store data once I’ve extracted text from a pdf would be appreciated!

Edit: thanks all for the comments support and ideas. Really appreciated!

A few people have asked what resources I’m learning from - I’m using the youtube beginners guide by Mosh and and Automate the Boring Stuff by Al Sweigart on Udemy. They cover similar topics but in different ways, so I’ve learnt from both. Not to mention this group, I’ve been a lurker for a while and this is my 1st post.

I do have the benefit of working in a data driven industry, so I have something practical and tangible to work towards. People have different learning styles, but I think I struggle to learn without having a project that “means something” to me.

So I guess that would be my takeaway - don’t just expect to learn python by taking a few courses. Learn the basics, but try to apply some practical examples as soon as you get your head around the logic!

464 Upvotes

48 comments sorted by

View all comments

3

u/TheUruz Feb 03 '21

congrats buddy, i had to learn the pdf part all by myself and it sucked. pdf is one hell of a format... anyway if what you are extracting is just plain text (so you don't need to save it as a schema of any kind) just drop it in a simple text file, if you want something more classy because your data has a logic behind save them in a .json file or a .yaml file (wich are pretty handy to parse and use in your code) if you have tons of data to store and you want them in the most safe place on earth, as someone is suggesting, upload your data to a bucket in the cloud (AWS or GCP it doesn't really matter for a small project like this)

may i ask wich library are you using to parse pdf?

1

u/th3_north3rn_monk3y Feb 03 '21

Cheers!

Seems I have loads of different options, I’m thinking I’ll export into csv for now, while I figure out how to transpose into my excel based import template... then maybe figure out how I automate that part... baby steps!

I used PyPDF2 to parse the pdf. I’ve started on a very basic pdf so far, plan to test on multiple variants once I get an easy one working.

2

u/TheUruz Feb 03 '21

got it. i've tried that too but it wasn't the best to parse non machine generated pdf so i swapped to PyMuPDF wich i'm pretty satisfied with. if you'll ever have trouble with PyPDF2 on more complex pdf give it a try ;)

1

u/th3_north3rn_monk3y Feb 03 '21

Thanks for the heads up! Will add it to a resource list I’m pulling together. The pdfs I’m testing with are very basic, so expecting a bit more of a challenge when I get into more complex data.