Motive There are different types of modules in python which not everyone knows so we thought of introducing them to you guys. Let's start! Note: This is not a tutorial of how to use these but is to show that these modules also exist and if you want to know more you can visit there own page and if you want us to explain leave a comment below. Links to there page are also given below. Hope you found something useful. 1.Wikipedia Yes, there is a module called Wikipedia in python, you can easily install Wikipedia by pip install wikipedia . We cannot rely on this module for advanced use. It was designed for ease of use and simplicity. Learn More Here . Here is a simple example: import wikipedia wikiPython = wikipedia.summary("Python", sentences=2) print(wikiPython) One big disadvantage is that it works only if the interne...
Motive
QR Codes are seen everywhere, even tho it's not really
useful we could encrypt some data in them or we could even use it for other
backend purposes. Let's begin!
Project
Before starting to make a project lets install the
necessary modules for this project, pyqrcode and pypng. Even tho
we are not importing pypng directly the module pyqrcode imports it and
if we try running without installing pypng we will get an error so
install both of them.
Open your cmd and type those codes separately to install
pyqrcode and pypng and you can learn more about
pyqrcode here and
pypng here.
Let's start by importing the necessary modules for our project:
It's not necessary to import os. But
if you want to open the QR code after it's created by the program, you have
to import os else go the folder where the program is and open it from
there.
Now let's create a variable called text and then give it the text that
we need to encrypt:
Then we create another variable called
qrcode and we create the QR code with using the module
pyqrcode and give it the value which we need to convert to a QR code,
in our case, it's the variable text in the parathesis.
Now let's make in in a png file:
Here we take variable qrcode and convert it into a png
file and we give the name of the file as a string and give a value for the
scale.
Basically, that's it now let's open the QRcode that we made with the help of
os:
If you haven't set our QR Code to Text blog you can't check it here - https://timesofpython.blogspot.com/2020/06/python-qr-code-decoder-qr-code-to-text.html
If you have any doubts or errors in the program feel free to comment down below and I will respond as early as possible. And if I
have made any mistake please correct me in the comment box below. Don't forget to follow us for such python related content.
Comments
Post a Comment