Search

What Is a Tuple in Python?

Python is among the most popular and fastest growing high level, general-purpose programming language which works upon the interpretation method. The main reason behind its growth is its simple coding syntax and methods, which help in writing shorter and simpler codes as compared to other similar programming languages such as C++, Java, etc. Although Python had been developed in the 1980s, it was commercially launched in 1991. One of the most interesting and surprising facts about languages is that usually the creators of a language are unknown but in the case of Python, we know its creator’s name. It was developed by Guido van Rossum and is currently managed by the Python Foundation. This language got its name from a very popular show, Monty Python's Flying Circus, a BBC comedy series from the 1970s. Python is a multi-paradigm programming language that supports Object oriented programming and structured programming along with functional programming and aspect oriented programming. Unlike others, it uses white space indentation while other languages use curly brackets, keywords, etc for their indentation. This white space indentation is referred to as the off-side rule which was also used by some other languages but they usually don't have any semantic meaning. Its design emphasizes a lot on code readability by the significant use of white spaces so that everyone can easily understand the written code by anyone. Also, its object-oriented method approach helps in giving a tough competition to Java. In this article, we take you on an in-depth tutorial on Tuple in Python. We will learn the methods of tuple creation, accessing tuple, tuple functions in Python, etc.There are several built-in data types in Python, such as List, Set, Dictionary, etc. Somewhat similar to arrays in C++, there is one such built-in data type called Tuple in Python.  A tuple can be considered a data type that acts as a container or collection of different data types in an ordered and unchangeable manner. Unlike an array, these tuples in Python are written with round brackets. Even lists have a very similar character to that of a tuple, but the major difference between them is that after assigning the elements to a tuple, it can't be changed, but the elements of a list can be changed.In a very short period, Python has not only proved itself to be a useful and popular programming language among the masses, but it has also become an inspiration for several other programming languages such as Boo, Cobra, GDScript, Groovy, Julia, Nim, Ruby, etc. These days Python is being extensively used in nearly every field for programming.Tuple Items The elements which we contain inside the parentheses are called tuple items, which can be of any type, i.e., integer, float, char, double, string, etc. Elements can be inserted inside a tuple during tuple creation, as shown in the above examples. But an important point to note is that  elements can't be changed in a tuple in Python after getting assigned values.  Some unique properties of tuple items are as follows: Ordered: The tuple elements always stay in an ordered manner that can’t be changed after declaration. So every programmer or coder needs to be very careful while placing the elements in a tuple to ignore any sort of errors during execution. Unchangeable: Elements can’t be changed in tuples in Python after declaration.But if a tuple contains elements of a mutable data type such as list, then the nested items can be changed.Eg.,first_tuple = (3,1,8, [6,8])  first_tuple[3][0] = 7  print(first_tuple)  # Here the first element of list will be changed and printed. Output : (3, 1, 8, [7, 8])Also, although the values of a tuple can’t be changed, they can be reassigned according to the changed or updated circumstances. Eg.,first_tuple = (1, 2, 3, 4)  print(first_tuple)Output : (1, 2, 3, 4)If we wish to reassign, then first_tuple = (5,6,7,8)  print(first_tuple)  # Here new values will be assigned to the tuple first_tuple. Output :(5, 6, 7, 8) Allow Duplicates: Python gives you the freedom to insert duplicate values in tuples as every element is indexed, which means that every element has its unique identity and hence can be easily accessed during execution. Eg.,first_tuple = (1,8,8,4,4)  print(first_tuple) Output : (1, 8, 8, 4, 4) Tuples Items – Data Types A tuple can accept data of any data type such as integer, float, double, string, etc. Eg.,first_tuple1 = (“mango”, “guava”, “banana”)  first_tuple2 = (1,8,4,5,)  first_tuple3 = (True, False, False)  print(first_tuple1)  print(first_tuple2)  print(first_tuple3) Output :   ('mango', 'guava', 'banana')  (1, 8, 4, 5)  (True, False, False) How to add tuples in PythonA tuple in Python can be created by placing all the desired elements inside the round brackets (), which should be separated by comma ',.' Even though the parentheses, i.e., round brackets are optional, it's a good practice to use them to increase the readability of the code. Unlike arrays in C++, tuples can have different types of data in a single parenthesis and hence can be classified as different types. Here are some examples with their output: 1. Empty Tuple: A tuple with no values Eg., first_tuple = ()  print(first_tuple) Output : () 2. Tuple Having Integers Eg.,first_tuple = (5, 4, 8, 9)  print(first_tuple)Output : (5, 4, 8, 9) 3. Mixed Tuple: A tuple that has different data types like float, int, string, etc. Eg., first_tuple = (5, “Python”, 8)  print(first_tuple) Output :(5, ‘Python’, 8) 4. Nested Tuple: Single or more tuples inside a tuple. Eg.,first_tuple = (“Python”, (4, 6, 8), (1, 3, 5))  print(first_tuple) Output : (‘Python’, (4, 6, 8), (1, 3, 5))If a tuple is created without using any parentheses, it is called tuple packing. Eg.,first_tuple = 7, 8, 9, “creation”  print(first_tuple) Output : (7, 8, 9, ‘creation’ ) Tuple packing can also be unpacked. Eg.,a, b, c = first_tuple  print(a)  print(b)  print(c) Output : 7  8  9  creation If you want to create a tuple with just one element, then you should remember to put a trailing comma to classify it as a tuple. Eg.,first_tuple = (50,)  print(first_tuple)Output : (50, ) Accessing tuple items Tuple elements can be accessed by various methods, which are as follows: 1. IndexingThe index in a tuple starts from 0, accessed by the index operator []. The index can't be any other value except integer, which should be in the tuple range index.  For, e.g.,  To access elements in the following tuple. first_tuple = (2, 8, 6, 4, 3, 5, )  print(first_tuple[2])  print(first_tuple[4.6])  print(first_tuple[7]) Output : 6  #TypeError  #IndexError 2. Negative Indexing The elements of tuples in Python can also be accessed by using negative indexing, such as -1 for the last element, -2 for the second last, and so on. For Eg.,  To access elements in the following tuple.  first_tuple = (2, 8, 6, 4, 3, 5, )  print(first_tuple[-2])  # Here the second last element in the tuple will be printed. Output : 3 3. SlicingIn Python, you can also access a range of tuple items using slicing operator colon ':’ For, e.g.,To access elements in the following tuple.  first_tuple = (2, 8, 6, 4, 3, 5, )  print(first_tuple[2:4])  # Here the elements from index 2 to 3 will be printed. Output : (6, 4)Tuple Length Tuple functions in Python have a dedicated function to determine the length of tuples, i.e., the no of elements a tuple contains. len() function is used to determine the length of a tuple. For eg.,first_tuple = (5,6,7,5,8,)  print(len(first_tuple))  #It will show the no of indexed elements in the tuple first_tuple. Output :5 type() In Python, tuples can be defined as objects with ‘tuple’ as their data type. Type () function is used to find the data type of the tuple. It’s an important tuple function in Python. It helps in the correction of minor mistakes; such as creating a tuple with a single element and forgetting to add the comma ',' at the end of the single element. This example will not be considered as a tuple by Python. The following examples will clarify this concept. Eg.,first_tuple1 = (5)  first_tuple2 = (5,)  print(type(first_tuple1))  print(type(first_tuple2))  #Although these tuples look similar, their output will vary due to a single comma. Output : <class ‘int’>  <class ‘tuple’>The tuple() Constructor The tuple() constructor is a tuple method in Python that makes the construction of a tuple by using a constructor. The use of a tuple constructor will be clear from the given example; notice the double brackets. Eg.,first_tuple = tuple((1, “story”, 5))    print(first_tuple) Output :(1, ‘story’, 5) Deleting a tuple The most problematic drawback of a tuple in Python is that once created, it cannot be changed. However, it can be deleted entirely by using the keyword 'del.' The use of this keyword is illustrated below. Eg.,first_tuple = (50,)  print(first_tuple)Output :(50)Now, let’s use the keyword del del (first_tuple)  print(first_tuple) Output :NameError : name ‘first_tuple’ is not defined. Here, we can clearly see after using the keyword ‘del’, Python was unable to find the tuple declared earlier which shows that the tuple has been deleted entirely.Tuple Membership Test In Python, we can check to verify whether an element is a member of the tuple or not by using the keyword 'in,' which returns the result in a Boolean form like True or False. Its use is illustrated below. Eg., first_tuple = (1,5,6,89,7)  print(1 in first_tuple)  print(2 in first_tuple) Here, these codes will check and verify whether 1 and 2 are a part of the tuple first_tuple and will provide an output as follows: Output :True  False For Loop in a Tuple A for loop can be used to obtain a simultaneous output with the continuous elements of a tuple. Suppose you want to print the name of members of a group with a 'Hello!', in such a case it could be very useful. It would be clear from the following example. Eg.,for name in (‘Aditya’, ‘Aditi’)   print(“Hello”, name) Output : Hello Aditya  Hello Aditi Python Collections (Arrays) Collection data types play a major role in any programming language as they are pretty useful for storing large collections of data under a single variable. In Python, we have 4 different types of collection data types, which are explained below. List In the case of the list in Python, the elements are placed in an ordered manner, which can be modified; that is, its elements can be changed, added, or deleted as per the need, and it also allows duplicate values. Tuple We have studied this collection data type so far and learned its several properties, methods, and functions. It is an ordered collection that cannot be changed but allows duplicate entries. Set A set in Python is a collection data type that is unordered and unindexed, and also, it does not allow any duplicate entries. It is useful for collecting those data that need to have some unique identifier such as ID, Roll No, etc. Dictionary Dictionary is a collection data type that is somewhat similar to set but has a slight variation: it is indexed, and hence its values can be changed easily. Also, it is ordered and doesn't contain any duplicate members. Conclusion This article helped you understand the nuances of the collective data type Tuple in Python, such as its properties, functions, methods, applications, etc., with various examples and codes.  Also, we came across other similar collective data types such as set, dictionary, and list, which are also available in Python and have their specific properties and functions and are hence used accordingly. Now the question arises that which collective data type we should use in our programs so that it results in a beautifully written and well readable code that everyone can easily understand. As is clear from our discussion, every data type has its properties and has its own weak as well as strong points. So, anyone should keep those points in mind, while selecting the correct collective data type for them. For instance, if someone wants to have a collection with unique entries, they should go with a set or dictionary. To have the freedom to change the item at convenience, you should choose a dictionary. Further, if one wants to have an indexed and ordered arrangement that must contain duplicate entries, such as for entering marks of a student, they should choose a list or tuple. Tuples in Python, are a pretty useful tool for coders to code with ease and comfort. It has several advantages and benefits for easily developing a program. Try some hands-on coding with this marvelous language and have fun playing with the codes while exploring the unknown paths. Develop innovative applications that may prove your worth as a formidable Python coder.

What Is a Tuple in Python?

7K
  • by Abhresh S
  • 23rd Mar, 2021
  • Last updated on 24th Mar, 2021
  • 7 mins read
What Is a Tuple in Python?

Python is among the most popular and fastest growing high levelgeneral-purpose programming language which works upon the interpretation method. The main reason behind its growth is its simple coding syntax and methods, which help in writing shorter and simpler codes as compared to other similar programming languages such as C++, Java, etc. Tuple in python

Although Python had been developed in the 1980s, it was commercially launched in 1991. One of the most interesting and surprising facts about languages is that usually the creators of a language are unknown but in the case of Python, we know its creator’s name. It was developed by Guido van Rossum and is currently managed by the Python Foundation. This language got its name from a very popular show, Monty Python's Flying Circus, a BBC comedy series from the 1970s. 

Python is a multi-paradigm programming language that supports Object oriented programming and structured programming along with functional programming and aspect oriented programming. Unlike others, it uses white space indentation while other languages use curly brackets, keywords, etc for their indentation. This white space indentation is referred to as the off-side rule which was also used by some other languages but they usually don't have any semantic meaning. Its design emphasizes a lot on code readability by the significant use of white spaces so that everyone can easily understand the written code by anyone. Also, its object-oriented method approach helps in giving a tough competition to Java. In this article, we take you on an in-depth tutorial on Tuple in PythonWe will learn the methods of tuple creation, accessing tuple, tuple functions in Python, etc.

There are several built-in data types in Python, such as List, Set, Dictionary, etc. Somewhat similar to arrays in C++, there is one such built-in data type called Tuple in Python.  A tuple can be considered a data type that acts as a container or collection of different data types in an ordered and unchangeable manner. Unlike an array, these tuples in Python are written with round brackets. Even lists have a very similar character to that of a tuple, but the major difference between them is that after assigning the elements to a tuple, it can't be changed, but the elements of a list can be changed.

In a very short period, Python has not only proved itself to be a useful and popular programming language among the masses, but it has also become an inspiration for several other programming languages such as Boo, Cobra, GDScript, Groovy, Julia, Nim, Ruby, etc. These days Python is being extensively used in nearly every field for programming.

Tuple Items 

The elements which we contain inside the parentheses are called tuple items, which can be of any type, i.e., integer, float, char, double, string, etc. Elements can be inserted inside a tuple during tuple creation, as shown in the above examples. But an important point to note is that  elements can't be changed in a tuple in Python after getting assigned values.  

Some unique properties of tuple items are as follows: 

  • Ordered: The tuple elements always stay in an ordered manner that can’t be changed after declaration. So every programmer or coder needs to be very careful while placing the elements in a tuple to ignore any sort of errors during execution. 
  • Unchangeable: Elements can’t be changed in tuples in Python after declaration.

But if a tuple contains elements of mutable data type such as list, then the nested items can be changed.

Eg.,

first_tuple = (3,1,8, [6,8]) 
first_tuple[3][0] = 7 
print(first_tuple) 
# Here the first element of list will be changed and printed. 

Output : 

(3, 1, 8, [7, 8])

Also, although the values of a tuple can’t be changed, they can be reassigned according to the changed or updated circumstances. 

Eg.,

first_tuple = (1, 2, 3, 4) 
print(first_tuple)

Output : 

(1, 2, 3, 4)

If we wish to reassign, then 

first_tuple = (5,6,7,8) 
print(first_tuple) 
# Here new values will be assigned to the tuple first_tuple. 

Output :

(5, 6, 7, 8) 
  • Allow Duplicates: Python gives you the freedom to insert duplicate values in tuples as every element is indexed, which means that every element has its unique identity and hence can be easily accessed during execution. 

Eg.,

first_tuple = (1,8,8,4,4) 
print(first_tuple) 

Output : 

(1, 8, 8, 4, 4) 

Tuples Items – Data Types Working with Tuples Data Types in python

A tuple can accept data of any data type such as integer, float, double, string, etc. 

Eg.,

first_tuple1 = (“mango”, “guava”, “banana”) 
first_tuple2 = (1,8,4,5,) 
first_tuple3 = (True, False, False) 
print(first_tuple1) 
print(first_tuple2) 
print(first_tuple3) 

Output :   

('mango', 'guava', 'banana') 
(1, 845) 
(True, False, False) 

How to add tuples in Python

A tuple in Python can be created by placing all the desired elements inside the round brackets (), which should be separated by comma ',.' Even though the parentheses, i.e., round brackets are optional, it's a good practice to use them to increase the readability of the code. 

Unlike arrays in C++, tuples can have different types of data in a single parenthesis and hence can be classified as different types. Here are some examples with their output: 

1. Empty Tuple: A tuple with no values 

Eg.

first_tuple = () 
print(first_tuple) 

Output : 

() 

2. Tuple Having Integers 

Eg.,

first_tuple = (5, 4, 8, 9) 
print(first_tuple)

Output : 

(5, 4, 8, 9) 

3. Mixed Tuple: A tuple that has different data types like float, int, string, etc. 

Eg.

first_tuple = (5, “Python”, 8) 
print(first_tuple) 

Output :

(5, ‘Python’, 8) 

4. Nested Tuple: Single or more tuples inside a tuple. 

Eg.,

first_tuple = (“Python”, (4, 6, 8), (1, 3, 5)) 
print(first_tuple) 

Output : 

(‘Python’, (4, 6, 8)(1, 3, 5))

If a tuple is created without using any parentheses, it is called tuple packing. 

Eg.,

first_tuple = 7, 8, 9, “creation” 
print(first_tuple) 

Output : 

(7, 8, 9, ‘creation’ ) 

Tuple packing can also be unpacked. 

Eg.,

a, b, c = first_tuple 
print(a) 
print(b) 
print(c) 

Output : 

7 
8 
9 
creation 

If you want to create a tuple with just one element, then you should remember to put a trailing comma to classify it as a tuple. 

Eg.,first_tuple = (50,) 
print(first_tuple)

Output : 

(50, ) 

Accessing tuple items 

Tuple elements can be accessed by various methods, which are as follows: 

1. Indexing

The index in a tuple starts from 0, accessed by the index operator []. The index can't be any other value except integer, which should be in the tuple range index.  

For, e.g.,  

To access elements in the following tuple. 

first_tuple = (2, 8, 6, 4, 3, 5, ) 
print(first_tuple[2]) 
print(first_tuple[4.6]) 
print(first_tuple[7]) 

Output : 

6 
#TypeError 
#IndexError 

2. Negative Indexing 

The elements of tuples in Python can also be accessed by using negative indexing, such as -1 for the last element, -2 for the second last, and so on. 

For Eg.,  

To access elements in the following tuple. 
first_tuple = (2, 8, 6, 4, 3, 5, ) 
print(first_tuple[-2]) 
# Here the second last element in the tuple will be printed. 

Output : 

3 

3. Slicing

In Python, you can also access a range of tuple items using slicing operator colon ': 

For, e.g.,

To access elements in the following tuple. 
first_tuple = (2, 8, 6, 4, 3, 5, ) 
print(first_tuple[2:4]) 
# Here the elements from index 2 to 3 will be printed. 

Output :

 (6, 4)

Tuple Length 

Tuple functions in Python have a dedicated function to determine the length of tuples, i.e., the no of elements a tuple contains. len(function is used to determine the length of a tuple. 

For eg.,

first_tuple = (5,6,7,5,8,) 
print(len(first_tuple)) 
#It will show the no of indexed elements in the tuple first_tuple. 

Output :

5 

type() 

In Python, tuples can be defined as objects with ‘tuple’ as their data type. Type () function is used to find the data type of the tuple. It’s an important tuple function in Python. It helps in the correction of minor mistakes; such as creating a tuple with a single element and forgetting to add the comma ',' at the end of the single element. This example will not be considered as a tuple by Python. 

The following examples will clarify this concept. 

Eg.,

first_tuple1 = (5) 
first_tuple2 = (5,) 
print(type(first_tuple1)) 
print(type(first_tuple2)) 
#Although these tuples look similartheir output will vary due to a single comma. 

Output : 

<class ‘int’> 
<class ‘tuple’>

The tuple() Constructor 

The tuple() constructor is a tuple method in Python that makes the construction of a tuple by using a constructor. The use of a tuple constructor will be clear from the given example; notice the double brackets. 

Eg.,

first_tuple = tuple((1, “story”, 5))   
print(first_tuple) 

Output :

(1, ‘story’, 5) 

Deleting a tuple 

The most problematic drawback of a tuple in Python is that once created, it cannot be changed. However, it can be deleted entirely by using the keyword 'del.' The use of this keyword is illustrated below. 

Eg.,

first_tuple = (50,) 
print(first_tuple)

Output :

(50)

Now, let’s use the keyword del 

del (first_tuple) 
print(first_tuple) 

Output :

NameError : name ‘first_tuple’ is not defined. 

Here, we can clearly see after using the keyword ‘del’, Python was unable to find the tuple declared earlier which shows that the tuple has been deleted entirely.

Tuple Membership Test 

In Python, we can check to verify whether an element is a member of the tuple or not by using the keyword 'in,' which returns the result in a Boolean form like True or FalseIts use is illustrated below. 

Eg.

first_tuple = (1,5,6,89,7) 
print(1 in first_tuple) 
print(2 in first_tuple) 

Here, these codes will check and verify whether 1 and 2 are a part of the tuple first_tuple and will provide an output as follows: 

Output :

True 
False 

For Loop in a Tuple 

A for loop can be used to obtain a simultaneous output with the continuous elements of a tuple. Suppose you want to print the name of members of a group with a 'Hello!', in such a case it could be very useful. It would be clear from the following example. 

Eg.,

for name in (‘Aditya’, ‘Aditi’) 
 print(“Hello”, name) 

Output : 

Hello Aditya 
Hello Aditi 

Python Collections (Arrays) 

Collection data types play a major role in any programming language as they are pretty useful for storing large collections of data under a single variable. In Python, we have 4 different types of collection data types, which are explained below. 

  • List 

In the case of the list in Python, the elements are placed in an ordered manner, which can be modified; that is, its elements can be changed, added, or deleted as per the need, and it also allows duplicate values. 

  • Tuple 

We have studied this collection data type so far and learned its several properties, methods, and functions. It is an ordered collection that cannot be changed but allows duplicate entries. 

  • Set 

A set in Python is a collection data type that is unordered and unindexed, and also, it does not allow any duplicate entries. It is useful for collecting those data that need to have some unique identifier such as ID, Roll No, etc. 

  • Dictionary 

Dictionary is a collection data type that is somewhat similar to set but has a slight variation: it is indexed, and hence its values can be changed easily. Also, it is ordered and doesn't contain any duplicate members. 

Conclusion 

This article helped you understand the nuances of the collective data type Tuple in Python, such as its properties, functions, methods, applications, etc., with various examples and codes.  Also, we came across other similar collective data types such as set, dictionary, and list, which are also available in Python and have their specific properties and functions and are hence used accordingly. 

Now the question arises that which collective data type we should use in our programs so that it results in a beautifully written and well readable code that everyone can easily understand. 

As is clear from our discussion, every data type has its properties and has its own weak as well as strong points. So, anyone should keep those points in mind, while selecting the correct collective data type for them. 

For instance, if someone wants to have a collection with unique entries, they should go with a set or dictionary. To have the freedom to change the item at convenience, you should choose a dictionary. Further, if one wants to have an indexed and ordered arrangement that must contain duplicate entries, such as for entering marks of a student, they should choose a list or tuple. 

Tuples in Python, are a pretty useful tool for coders to code with ease and comfort. It has several advantages and benefits for easily developing a program. Try some hands-on coding with this marvelous language and have fun playing with the codes while exploring the unknown paths. Develop innovative applications that may prove your worth as a formidable Python coder.

Abhresh

Abhresh S

Freelance Corporate Trainer

An Online Technical Trainer by profession! And Content writer by hobby! Interested in sharing quality knowledge to make the Industry grow better towards better success and better tomorrow! With a Guru Mantra of - "Keep Learning & Keep Practicing".

Join the Discussion

Your email address will not be published. Required fields are marked *

SPECIAL OFFER Upto 20% off on all courses
Enrol Now

Trending blog posts

Suggested Blogs

Six Tips To Improve As Android Developer

Mobile applications are increasing day by day and that is all because of increasing craze and trend of Android development course among individuals. Evolution of these mobile applications has given people an interesting and innovative ways to stay connected with each other. The statistics say it all, Android market leads the position with 2.2 million apps available for download (as of June 2016). With the numbers only we can tell the increased demand for Android developers. Digital era has already started and we are already witnessing the emerging market for these new age jobs. Android development surely has a bright future but with proper Android development training and certification will take you to new heights. As the market for Android development is booming, it is mandatory for an Android developers to have the proper skill set. Let’s explore some basic and essential tips to become a good Android developer. Design does matter One of the primary areas to concentrate on will be your app design. You might be having a great idea and proper skill sets to become an android developer, but if you fail in to attract people just because of bad execution of your ideas, it does not matter how creative your app is because people are not going to turn their heads towards poorly designed applications. Android platform should be your primary concern We know that this article is primarily for android developers, but this point is worth noting. iOS gets more premium quality apps than android (at least sooner than android) because iOS users do not worry about spending a few bucks on their apps, android users, on the other hand, are less targeted towards purchasing the apps. This should not stop you from developing applications for android, the reason being there are more than 1000 million android devices out there and you will be missing out millions of customers. Releasing applications for free “How do I make my money back then?” is the first question that pops into your mind. Well as said before, android users want their applications to be free and you can make your money back by using ads in your application. If this does not work for you, develop two different applications with slightly different features (premium and regular). The premium app should have slightly more features than the normal version and you can release it as paid version while as the normal app can be released for free with slightly fewer features or with ads. But remember this, DO NOT compromise on quality on either of the applications. Being passionate leads to better development Building something that can solve real life problems can help App developers to kick start the early traction. It requires passion and persistence which lacks in many developers. Developing better applications requires some persistence in the work. Treating yourself as the most important user of the application will work in your favour. If you are really passionate about creating something out of the box, persistence is the only way. Top App developers around the globe would still create apps even if they are not getting paid. Teaming Up We all know that having a team makes work better. Developing android applications is nothing but working in a small core team and creating it bit by bit. Technically sound people working together will faster the work. Applications have many aspects which can’t be dealt by a single person. Having a small technical team with well-coordinated people can make things really easy. Languages to Focus On: A successful android developer needs to be proficient in few programming languages which will help in developing better application. These languages consist of Java, SQL and XML. Developers should be well versed in Java as it is the most in-demand language. Creating an android application requires the database and he should be well-versed in SQL. XML works along with SQL and Java as it performs tasks like parsing data feeds, designing UI and more. The above-mentioned points should be given priority before developing any android apps, remember that there are several other ways for you to become a good android developer. Intensive research on developing applications is strongly recommended.
Six Tips To Improve As Android Developer

Mobile applications are increasing day by day and ... Read More

What are Python KeyError Exceptions and How to Handle Them

There are times when you have written your code but while you execute, it might not run. These types of situations occur when the input is inappropriate or you try to open a file with a wrong path or try to divide a number by zero. Due to some errors or incorrect command the output will not be displayed. This is because of errors and exceptions which are a part of the Python programming language. Learn about such concepts and gain further knowledge by joining Python Programming Course.What is Exception Handling?Python raises exceptions when it encounters errors during execution. A Python Exception is basically a construct that signals any important event, such as a run-time error.Exception Handling is the process of responding to executions during computations, which often interrupts the usual flow of executing a program. It can be performed both at the software level as part of the program and also at hardware level using built-in CPU mechanisms.Why is Exception Handling Important?Although exceptions might be irritating when they occur, they play an essential role in high level languages by acting as a friend to the user.An error at the time of execution might lead to two things— either your program will die or will display a blue screen of death. On the other hand, exceptions act as communication tools. It allows the program to answer the questions — what, why and how something goes wrong and then terminates the program in a delicate manner.In simple words, exception handling protects against uncontrollable program failures and increases the potency and efficiency of your code. If you want to master yourself in programming, the knowledge of exceptions and how to handle them is very crucial, especially in Python.What are the Errors and Exceptions in Python?Python doesn’t like errors and exceptions and displays its dissatisfaction by terminating the program abruptly.There are basically two types of errors in the Python language-Syntax Error.Errors occuring at run-time or Exceptions.Syntax ErrorsSyntax Errors, also known as parsing errors, occur when the parser identifies an incorrect statement. In simple words, syntax error occurs when the proper structure or syntax of the programming language is not followed.An example of a syntax error:>>> print( 1 / 0 )) File "", line 1 print( 1 / 0 ))   ^SyntaxError: invalid syntaxExceptionsExceptions occur during run-time. Python raises an exception when your code has a correct syntax but it encounters a run-time issue which it is not able to handle.There are a number of defined built-in exceptions in Python which are used in specific situations. Some of the built-in exceptions are:ExceptionCause Of ErrorArithmeticErrorRaised when numerical computation fails.FloatingPointErrorRaised when floating point calculation fails.AssertionErrorRaised in case of failure of the Assert statement.ZeroDivisionErrorRaised when division or modulo by zero takes place for all numerical values.OverflowErrorRaised when result of an arithmetic operation is very large to be represented.IndexErrorRaised when an index is not found in a sequence.ImportErrorRaised when the imported module is not found.IndentationErrorRaised when indentation is not specified properly.KeyboardInterruptRaised when the user hits interrupt key.RuntimeErrorRaised when a generated error does not fall into any category.SyntaxErrorRaised when there is an error in Python syntax.IOErrorRaised when Python cannot access a file correctly on disk.KeyErrorRaised when a key is not found in a dictionary.ValueErrorRaised when an argument to a function is the right type but not in the right domain.NameErrorRaised when an identifier is not found in the local or global namespace.TypeErrorRaised when an argument to a function is not in the right type.There are another type of built-in exceptions called warnings. They are usually issued in situations where the user is alerted of some conditions. The condition does not raise an exception; rather it  terminates the program.What is a Python KeyError?Before getting into KeyError, you must know the meaning of dictionary and mapping in Python. Dictionary (dict) is an unordered collection of objects which deals with data type key. They are Python’s implementation of data structures and are also known as associative arrays. They comprise key-value pairs, in which each pair maps the key to its associated value.Dictionary is basically a data structure that maps one set of values into another and is the most common mapping in Python.Exception hierarchy of KeyError:->BaseException              ->Exception                         ->LookupError                                       ->KeyErrorA Python KeyError is raised when you try to access an invalid key in a dictionary. In simple terms, when you see a KeyError, it denotes that the key you were looking for could not be found.An example of KeyError:>>> prices = { 'Pen' : 10, 'Pencil' : 5, 'Notebook' : 25} >>> prices['Eraser'] Traceback (most recent call last): File "", line 1, in prices['Eraser'] KeyError: 'Eraser'Here, dictionary prices is declared with the prices of three items. The KeyError is raised when the item ‘Eraser’ is being accessed which is not present in prices.Whenever an exception is raised in Python, it is done using traceback, as you can see in the example code above. It tells why an exception is raised and what caused it.Let’s execute the same Python code from a file. This time, you will be asked to give the name of the item whose price you want to know:# prices.py prices = { 'Pen' : 10, 'Pencil' : 5, 'Notebook' : 25} item = input('Get price of: ') print(f'The price of {item} is {prices[item]}')You will get a traceback again but you’ll also get the information about the line from which the KeyError is raised:Get price of: Eraser Traceback (most recent call last): File "prices.py", line 5, in print(f'The price of {item} is {prices[item]}') KeyError: 'Eraser'The traceback in the example above provides the following information:A KeyError was raised.The key ‘Eraser’ was not found.The line number which raised the exception along with that line.Where else will you find a Python KeyError?Although most of the time, a KeyError is raised because of an invalid key in a Python dictionary or a dictionary subclass, you may also find it in other places in the Python Standard Library, such as in a zipfile. However, it denotes the same semantic meaning of the Python KeyError, which is not finding the requested key.An example of such:>>> from zipfile import ZipFile >>> my_zip_file = ZipFile('Avengers.zip') >>> my_zip_file.getinfo('Batman')Traceback (most recent call last): File "", line 1, in File "myzip.py", line 1119, in getinfo 'There is no item named %r in the archive' % name) KeyError: "There is no item named 'Batman' in the archive"In this example, the zipfile.ZipFile class is used to derive information about a ZIP archive ‘Batman’ using the getinfo() function. Here, the traceback indicates that the problem is not in your code but in the zipfile code, by showing the line which caused the problem. The exception raised here is not because of a LookUpError but rather due to the zipfile.ZipFile.getinfo()function call.When do you need to raise a Python KeyError?In Python Programming, it might be sensible at times to forcefully raise exceptions in your own code. You can usually raise an exception using the raise keyword and by calling the KeyError exception:>>> raise KeyError('Batman')Here, ‘Batman’ acts as the missing key. However, in most cases, you should provide more information about the missing key so that your next developer has a clear understanding of the problem.Conditions to raise a Python KeyError in your code:It should match the generic meaning behind the exception.A message should be displayed about the missing key along with the missing key which needs to be accessed.How to Handle a Python KeyError?The main motive of handling a Python KeyError is to stop unexpected KeyError exceptions to be raised. There are a number of number of ways of handling a KeyError exception.Using get()The get()is useful in cases where the exception is raised due to a failed dictionary LookupError. It returns either the specified key value or a default value.# prices.py prices = { 'Pen' : 10, 'Pencil' : 5, 'Notebook' : 25} item = input('Get price of: ') price = prices.get(item) if price:   print(f'The price of {item} is {prices[item]}')   else:   print(f'The price of {item} is not known')This time, you’ll not get a KeyError because the get() uses a better and safer method to retrieve the price and if not found, the default value is displayed:Get price of: EraserThe price of Eraser is not knownIn this example, the variable price will either have the price of the item in the dictionary or the default value ( which is None by default ).In the example above, when the key ‘Eraser’ is not found in the dictionary, the get() returns  None by default rather than raising a KeyError. You can also give another default value as a second argument by calling get():price = prices.get(item,0)If the key is not found, it will return 0 instead of None.Checking for KeysIn some situations, the get() might not provide the correct information. If it returns None, it will mean that the key was not found or the value of the key in Python Dictionary is actually None, which might not be true in some cases. In such situations, you need to determine the existence of a key in the dictionary. You can use the if and in operator to handle such cases. It checks whether a key is present in the mapping or not by returning a boolean (True or False) value:dict = dictionary() for i in range(50):   key = i % 10     if key in dict: dict[key] += 1 else: dict[key] = 1In this case, we do not check what the value of the missing key is but rather we check whether the key is in the dictionary or not. This is a special way of handling an exception which is used rarely.This technique of handling exceptions is known as Look Before You Leap(LBYL).Using try-exceptThe try-except block is one of the best possible ways to handle the KeyError exceptions. It is also useful where the get() and the if and in operators are not supported.Let’s apply the try-except block on our earlier retrieval of prices code:# prices.py prices = { 'Pen' : 10, 'Pencil' : 5, 'Notebook' : 25} item = input('Get price of: ') try: print(f'The price of {item} is {prices[item]}') except KeyError: print(f'The price of {item} is not known')Here, in this example there are two cases— normal case and a backup case. try block corresponds to the normal case and except block to the backup case. If the normal case doesn’t print the name of the item and the price and raises a KeyError, the backup case prints a different statement or a message.Using try-except-elseThis is another way of handling exceptions. The try-except-else  has three blocks— try block, except block and else block.The else condition in a try-except statement is useful when the try condition doesn’t raise an exception. However, it must follow all the except conditions.Let us take our previous price retrieval code to illustrate try-except-else:# prices.py prices = { 'Pen' : 10, 'Pencil' : 5, 'Notebook' : 25} item = input('Get price of:') try: print(f'The price of {item} is {prices[item]}') except KeyError: print(f'The price of {item} is not known') else: print(f'There is no error in the statement')First, we access an existing key in the try-except block. If the Keyerror is not raised, there are no errors. Then the else condition is executed and the statement is displayed on the screen.Using finallyThe try statement in Python can have an optional finally condition. It is used to define clean-up actions and is always executed irrespective of anything. It is generally used to release external sources.An example to show finally:# prices.py prices = { 'Pen' : 10, 'Pencil' : 5, 'Notebook' : 25} item = input('Get price of: ') try: print(f'The price of {item} is {prices[item]}') except KeyError: print(f'The price of {item} is not known') finally: print(f'The finally statement is executed')Remember, the finally statement will always be executed whether an exception has occurred or not.How to raise Custom Exceptions in Python?Python comprises of a number of built-in exceptions which you can use in your program. However, when you’re developing your own packages, you might need to create your own custom exceptions to increase the flexibility of your program.You can create a custom Python exception using the pre-defined class Exception:def square(x): if x
8279
What are Python KeyError Exceptions and How to Han...

There are times when you have written your code bu... Read More

How to Work With a PDF in Python

Whether it is an ebook, digitally signed agreements, password protected documents, or scanned documents such as passports, the most preferred file format is PDF or Portable Document Format. It was originally developed by Adobe and is a file format used to present and transfer documents easily and reliably. It uses the file extension .pdf. In fact, PDF being the most widely used digital media, is now considered as an open standard which is maintained by the International Standards Organization (ISO). Python has relatively easy syntax which makes it even easier for the ones who are in their initial stage of learning the language. The popular Python libraries are well suited and integrated which allows to easily extract documents from a PDF, rotate pages if required, split pdf to make separate documents, or add watermarks in them.Now an important question rises, why do we need Python to process PDFs? Well, processing a PDF falls under the category of text analytics. There are several libraries and frameworks available which are designed in Python exclusively for text analytics. This makes it easier to play with a PDF in Python. You can also extract information from PDF and use into Natural Language Processing or any other Machine Learning models. Get certified and learn more about Python Programming and apply those skills and knowledge in the real world.History of  pyPDF, PyPDF2, pyPDF4The first PyPDF package was released in 2005 and the last official release in 2010. After a year or so, a  company named Phasit sponsored a branch of the PyPDF called PyPDF2 which was consistent with the original package and worked pretty well for several years.A series of packages were released later on with the name of PyPDF3 and later renamed as PyPDF4. The biggest difference between PyPDF and the other versions was that the later versions supported Python3. PyPDF2 has been discarded recently. But since PyPDF4 is not fully backward compatible with the PyPDf2, it is suggested to use PyPDF2. You can also use a substitute package - pdfrw. Pdfrw was created by Patrick Maupin and allows you to perform all functions which PyPDF2 is capable of except a few such as encryption, decryption, and types of decompression.Some common libraries in PythonLet us look into some of the libraries Python offers to handle PDFs:PdfMiner It is a tool used to extract information from PDF documents. PDFMiner allows the user to analyze text data and obtain the definite location of a text. It provides information such as fonts and lines. We can also use it as a PDF transformer and a PDF parser.PyPDF2PyPDF2 is purely a Python library which allows users to split, merge, crop, encrypt, and transform PDFs. You can also add customized data, view options, and passwords to the documents. Tabula-pyIt is a Python wrapper of tabula-java which can read tables from PDF files and convert into Pandas Dataframe or into CSV/TSV/JSON file formats.SlateIt is a Python package which facilitates the extraction of information and is dependent on the PdfMiner package.PDFQueryA light Python wrapper which uses minimum code to extract data from PDFs.xPDFIt is an open source viewer of PDF which also includes an extractor, converter and other utilities. Out of all the libraries mentioned above, PyPDF2 is the most used to perform operations like extraction, merging, splitting and so on.Installing PyPDF2If you're using Anaconda, you can install PyPDF2 using pip or conda. To install PyPDF2 using pip, run the following command in the command line:pip install PyPDF2The module is case-sensitive. So you need to make sure that proper syntax is followed. The installation is really quick since PyPDF2 is free of dependencies.Extracting Document Information from a PDF in PythonPyPDF2 can be used to extract metadata and all sorts of texts from PDF when you are performing operations on preexisting PDF files. The types of data you can extract are:AuthorCreatorProducerSubjectTitleNumber of PagesTo understand it better, let us use an existing PDF in your system or you can go to Leanpub and download a book sample.The code for extracting the document information from the PDF—# get_doc_info.py from PyPDF2 import PdfFileReader def getinfo(path):     with open(path, 'rb') as f:         PDF = PdfFileReader(f)         information = PDF.getDocumentInfo()         numberofpages = PDF.getNumPages()     print(information)     author = information.author     creator = information.creator     producer =information .producer     subject = information.subject     title = information.title if __name__ == '__main__':     path = 'reportlab-sample.pdf'     getinfo(path)The output of the program above will look like—Here, we have firstly imported PdfFileReader from the PyPDF2 package. The class PdfFileReader is used to interact with PDF files like reading and extracting information using accessor methods. Then, we have created our own function getinfo with a PDF file as an argument and then called the getdocumentinfo(). This returned an instance of DocumentInformation. And finally we got extract information like the author, creator, subject or title, etc.getNumPages() is used to count the number of pages in the document. PdfMiner can be used when you want to extract text from a PDF file. It is potent and particularly designed for extracting text from PDF.We have learned to extract information from PDF. Now let’s learn how to rotate a PDF. Rotating pages in PDFA lot of times we receive PDFs which contain pages in landscape orientation instead of portrait. You may also find certain documents to be upside down, which happens while scanning a document or mailing. However, we can rotate the pages clockwise or counterclockwise according to our choice using Python with PyPDF2.The code for rotating the article is as follows—# rotate_pages.py from PyPDF2 import PdfFileReader, PdfFileWriter def rotate(pdf_path):     pdf_write = PdfFileWriter()     pdf_read = PdfFileReader(path)     # Rotate page 90 degrees to the right     page1 = pdf_read.getPage(0).rotateClockwise(90)     pdf_write.addPage(page1)     # Rotate page 90 degrees to the left     page2 = pdf_read.getPage(1).rotateCounterClockwise(90)     pdf_write.addPage(page2)     # Add a page in normal orientation     pdf_write.addPage(pdf_read.getPage(2))     with open('rotate_pages.pdf', 'wb') as fh:         pdf_write.write(fh) if __name__ == '__main__':     path = 'mldocument.pdf'     rotate(path)The output of the code will be as follows—Here firstly we imported the PdfFileReader and the PdfFileWriter so that we can write out a new PDF file. Then we declared a function rotate with a path to the PDF that is to be modified. Within the function, we created a read object pdf_read and write object pdf_write.Then, we used the getPage() to grab the pages. Two pages page1 and page2 are taken and rotated to 90 degrees clockwise and 90 degrees counterclockwise respectively using rotateClockwise() and rotateCounterClockwise().We used addPage() function after each rotation method calls. This adds the rotated page to the write object. The last page we add is page3 without any rotation.Lastly, we have used write() with a file-like parameter to write out the new PDF. The final PDF contains three pages, the first two will be in the landscape mode and rotated in reversed direction and the third page will be in normal orientation.Now we will learn to merge different PDFs into one.Merging PDFsIn many cases, we need to merge two PDFs into a single one. For example, suppose you are working on a project report and you need to print it and bind it into a book. It contains a cover page followed by the project report. So you have two different PDFs and you want to merge them into one PDF. You can simply use Python to do so. Let us see how can we merge PDFs into one.The code for merging two PDF documents using PyPDF in mentioned below:# pdf_merging.py from PyPDF2 import PdfFileReader, PdfFileWriter def pdfmerger(paths, output):     pdfwrite = PdfFileWriter()     for path in paths:         pdfread = PdfFileReader(path)         for page in range(pdfread.getNumPages()):             # Add each page to the writer object             pdfwrite.addPage(pdfread.getPage(page))     # Write out the merged PDF     with open(output, 'wb') as out:         pdfwrite.write(out) if __name__ == '__main__':     paths = ['document-1.pdf', 'document-2.pdf']     pdfmerger(paths, output='merged.pdf')Here we have created a function pdfmerger() which takes a number of inputs and a single output. Then we created a PdfFileReader() object for each PDF path and looped over the pages, added each page to the write object. Finally, using the write() function the object’s contents are written to the disk.PyPDF2 makes the process of merging simpler by creating the PdfFileMerger class.Code for merging two documents using PyPDF2—# pdf_merger2.py import glob from PyPDF2 import PdfFileMerger def merger(output_path, input_paths):     pdfmerge = PdfFileMerger()     file_handles = []     for path in input_paths:         pdfmerge.append(path)     with open(output_path, 'wb') as fileobj:         pdfmerge.write(fileobj) if __name__ == '__main__':     paths = glob.glob('d-1.pdf')     paths.sort()     merger('d-2.pdf', paths)The PyPDF2 makes it simpler in the way that we don’t need to loop the pages of each document ourselves.  Here, we created the object pdfmerge and looped through the PDF paths. The PyPDF2 automatically appends the whole document. Finally, we write it out.Let’s perform the opposite of merging now!Splitting PDFsThe PyPDF2 package has the ability to split up a single PDF into multiple PDFs. It allows us to split pages into different PDFs. Suppose we have a set of scanned documents in a single PDF and we need to separate the pages into different PDFs as per requirement, we can simply use Python to select pages we want to split and get the work done.Code for splitting a single PDF into multiple PDFs—# pdf_splitter.py import os from PyPDF2 import PdfFileReader, PdfFileWriter def splitpdf(path):     fname = os.path.splitext(os.path.basename(path))[0]     pdf = PdfFileReader(path)     for page in range(pdf.getNumPages()):         pdfwrite = PdfFileWriter()         pdfwrite.addPage(pdf.getPage(page))         outputfilename = '{}_page_{}.pdf'.format(             fname, page+1)         with open(outputfilename, 'wb') as out:             pdfwrite.write(out)         print('Created: {}'.format(outputfilename)) if __name__ == '__main__':     path = 'document-1.pdf'     splitpdf(path)Here we have imported the PdfFileReader and PdfFileWriter from PyPDF2. Then we created a function called splitpdf() which accepts the path of PDF we want to split. The first line of the function takes the name of the input file. Then we open the PDF and create a read object. Using the read object’s getNumPages(), we loop over all the pages.In the next step, we created an instance of PdfFileWriter inside the for loop. Then, we created a PDF write instance and added each page to it for each of the pages in the PDF input. We also created a unique filename using the original filename + the word ‘page’ + the page number + 1.Once we are done with running the script, we will have each of the pages of the input PDF split into multiple PDFs. Now let us learn how to add a watermark to a PDF and keep it secured.Adding Overlays/WatermarksAn image or superimposed text on selected pages in a PDF document is referred to as a Watermark. The Watermark adds security features and protects our rational property like images and PDFs. Watermarks are also called overlays.The PyPDF2 allows us to watermark documents. We just need to have a PDF which will consist of our watermark text, image or signature.Code for adding a watermark in a PDF—# watermarker.py from PyPDF2 import PdfFileWriter, PdfFileReader def watermark(inputpdf, outputpdf, watermarkpdf):     watermark = PdfFileReader(watermarkpdf)     watermarkpage = watermark.getPage(0)     pdf = PdfFileReader(inputpdf)     pdfwrite = PdfFileWriter()     for page in range(pdf.getNumPages()):         pdfpage = pdf.getPage(page)         pdfpage.mergePage(watermarkpage)         pdfwrite.addPage(pdfpage)     with open(outputpdf, 'wb') as fh:         pdfwrite.write(fh) if __name__ == '__main__':     watermark(inputpdf='document-1.pdf',               outputpdf='watermarked_w9.pdf',               watermarkpdf='watermark.pdf')The output of the code will look like— There are three arguments of the function watermark(): inputpdf: The path of the PDF that is to be watermarked. outputpdf: The path where the watermarked PDF will be saved. watermarkpdf: The PDF which contains the watermark.Firstly, we extract the PDF page which contains the watermark image or text and then open that PDF page where we want to give the desired watermark.Using the inputpdf, we create a read object and using the pdfwrite, we create a write object to write out the watermarked PDF and then iterate over the pages.Next, we call the page object’s mergePage and apply the watermark and add that to the write object pdfwrite.When the loop terminates, the watermarked PDF is written out to the disk and it’s done!Encrypting a PDFIn the PDF world, the PyPDF2 package allows an owner password which gives the user the advantage to work as an administrator. The package also provides the user password which allows us to open the document upon entering the password.The PyPDF2 basically doesn’t permit any allowances on any PDF file yet it allows the user to set the owner password and user password.Code to add a password and add encryption to a PDF—# pdf_encrypt.py from PyPDF2 import PdfFileWriter, PdfFileReader def encryption(inputpdf, outputpdf, password):     pdfwrite = PdfFileWriter()     pdfread = PdfFileReader(inputpdf)     for page in range(pdfread.getNumPages()):         pdfwrite.addPage(pdfread.getPage(page))     pdfwrite.encrypt(user_pwd=password, owner_pwd=None,                       use_128bit=True)     with open(outputpdf, 'wb') as fh:         pdfwrite.write(fh) if __name__ == '__main__':     encryption(inputpdf='document-1.pdf',                   outputpdf='document-1-encrypted.pdf',                   password='twofish')We declare a  function named encryption() with three arguments—the input PDF path, the output PDF path and the password that we want to keep. Then we create one read object pdfread and one write object pdfwrite. Now we loop over all the pages and add them to the write object since we need to encrypt the entire document.Finally, we call the encrypt() function which accepts three parameters—the user password, the owner password and the whether or not to use 128-bit encryption. The PDF  will be encrypted to 40-bit encryption if the argument use128bit is set to false. Also if the owner password is set to none, then it will be set to user password automatically.Reading the Table data from PDFSuppose you want to work with the Table data in Pdf, you can use tabula-py to read tables in a PDF. To install tabula-py, run:pip install tabula-pyCode to extract simple Text from pdf using PyPDF2:import tabula # readinf the PDF file that contain Table Data # you can find the pdf file with complete code in below # read_pdf will save the pdf table into Pandas Dataframe df = tabula.read_pdf("document.pdf") # in order to print first 5 lines of Table df.head()If you PDF file contains Multiple Tabledf = tabula.read_pdf("document.pdf",multiple_tables=True)If you want to extract Information from the specific part of any specific page of PDFtabula.read_pdf("document.pdf", area=(126,149,212,462), pages=1)If you want the output into JSON Formattabula.read_pdf("offense.pdf", output_format="json")Exporting PDF into ExcelSuppose you want to export a PDF into Excel, you can do so by writing the following code and convert the PDF Data into Excel or CSV.tabula.convert_into("document.pdf", "document_testing.xlsx", output_format="xlsx")Let us sum up what we have learned in the article:Extraction of data from a PDFRotate pages in a PDFMerge PDFs into one PDFSplit a PDF into many PDFsAdd watermarks or overlays in a PDFAdd password or encryption to a PDFReading table from PDFExporting PDF into Excel or CSVAs you have seen, PyPDF2 is one of the most useful tools available in Python. The features of PyPDF2 makes life easier whether you are working on a large project or even when you quickly want to make some changes to your PDF documents. Learn more about such libraries and frameworks as KnowledgeHut offers Python Certification Course for Programmers, Developers, Jr./Sr Software Engineers/Developers and anybody who wants to learn Python.
8368
How to Work With a PDF in Python

Whether it is an ebook, digitally signed agreement... Read More

20% Discount