Skip to main content

Posts

Showing posts from September, 2020

5 Unique and Useful Python modules.

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 internet is connected to your device. You can even control the number of sentences that you

Python Find IP Address | Python socket Library

  Motive          I don't even know what to write in the motive section, but as I usually write something in the motive section. This would help you find your IP address.  The Project         First import socket, and by the way it's pre-installed so, no pip install needed. The create a variable called hostname then we will get the hostname with sockets.gethostname(). Then create another variable called ipAddress then get our IP address with that hostname, socket.gethostbyname(hostname). Then just print ipAddress by print(ipAddress). That's it! The Full Code import socket hostname = socket.gethostname() ipAddress = socket.gethostbyname(hostname) print(ipAddress)         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 feel free to correct me in the comment box below.   Don't forget to follow us for such