Read PDF File | Python Simple Tutorial | #Shorts

preview_player
Показать описание
This python tutorial for beginners explains how to read text from a pdf file. Pdf documents often contain text that we would like to use, and we can use python code to extract text from a file in the pdf format.
The python code includes importing the python module PyPDF2 using an alias ‘py’ to help aid the readability of the code, then opening the document using the python open function with ‘rb’, and using the pdf file reader. The sample pdf document taken from the web is then read and the first page, at index 0, is used to extract the text using the ‘extractText’ function. This results in the pdf text that we can then print. We print the code for ease to read, show the code written in Spyder, and run the code to show how it works extracting the pdf text correctly.
What about pdf files with more than one page? We can use similar code to open and read the pdf document but here we use the numPages function to get the number of pages in the pdf file. Using a for loop we use the index to get each page, extract the text, and print the text from that page.
In a previous example with a more complex pdf document we found a considerable amount of white space between lines and words. To solve this issue, you can use a regular expression to substitute all sequences of the space character to one character between words.

#pythonlanguage #pythonfundamentals #pythontutorials

PYTHON PLAYLISTS ON YOUTUBE:
Python Coder – Beginner
Python Fun & Games
More Simple Python Tutorials
Simple Python
Python Regular Expressions

WHY LEARN CODING WITH DR CODIE:
If you want to know how to learn python then these python programming tutorials are for you. Hi, my name is Dr Codie and I have helped many students to learn python, Scratch, SQL and other programming languages. In these videos you see how to learn python using your existing knowledge and gain some tips for learning python. Codie means ‘helpful person’ and we want to help you not just learn python programming but to enjoy learning python. We start with python tutorials for beginners and then move to tutorials for more advanced learning. The videos teach python 3.

In my experience, success being a python coder comes down to getting the fundamentals right. You can then move onto advanced programming concepts and skills. You will understand how to do simple coding tasks and then we will show you the simple methods of putting lines or blocks of code together using this knowledge. Practice is essential for your skills to grow but again do not fear we will help you practice as well.

Learn to understand the logic and design aspects needed to become a good programmer, let us help you practice to keep improving and don’t forget the bonus of seeing first hand how to build the code and possible stumbling blocks when we explain the answers to the tasks set within the tutorial. You do not need to watch the whole video but if you do you will improve as a python coder!

SOCIAL MEDIA

SUBSCRIBE and you will know when the videos are available! Good luck!
Рекомендации по теме
Комментарии
Автор

Sorry if the video is blurred at the beginning, there is nothing we can change, it just needs to focus sometimes with short videos.
The exercise to get the sum of numbers will be released in the next day or so.
The HD version of this video is still processing so should be available soon. Enjoy!

DrCodie