Skip to main content

Posts

How to check the installed python version?

Check the python version your machine currently using by typing the following commands in your terminal. bash- 5.1 $ python -- version Python 3.9 . 12 Check the python version via the python script. #import sys module in python sys module contain tuple of strings containing all the built in modules and constants import sys print(sys.version) #get the python version Check which version you are using if you have multiple python versions installed. You can check what version of python you are using by typing python in the terminal. bash- 5.1 $ python Python 3.9 . 12 (main, Apr 5 2022 , 06 : 56 : 58 ) [GCC 7.5 . 0 ] :: Anaconda, Inc. on linux Type "help" , "copyright" , "credits" or "license" for more information. >>> Check the python interpreter location using the terminal. To check the python interpreter location type command which python command.  (base) bash- 5.1 $ which ...

Graphing with Python using Matplotlib

 Introduction Matplotlib is a graphing and plotting library that can be useful for creating different types of graphs and plots. Such as line charts, pie charts, scatter plots and 3D plots. Matplotlib can also be used for creating animated and interactive visualizations. It can also generate output in a variety of formats which includes PNG, SVG and PDF etc. Installing Matplotlib Matplotlib is not built into python. First, we need to install Matplotlib using the PIP package manager. pip install matplotlib If you are using Conda you can use the below command. conda install matplotlib You can refer to more about installation options on the Matplotlib installation page . Plotting Simple Graph using Matplotlib First, we need to import pyplot from Matplotlib library.  After that line, we give 2 python lists as arguments to plot()  function specifying Y values and X values for the graph. then we set the label for both the x...

Your First Rust Program - Hello World!

 Introduction  Rust is a robust, reliable, productive language(check rust language benchmarks ). The language has all the tools to write program efficiently and It also has a well written userfriendly documentation. In this tutorial, we will write our first Rust programme on a Linux machine and Introduce some syntax rules in Rust language. Installing Rust in Linux. We can install Rust in Linux easily. To download and install Rust you just need to copy and paste the below command and press enter key then it will download and install Rust into your machine using a tool called rustup . rustup is a command line tool for rust installer and version management. curl --proto &apos ;=https &apos ; --tlsv1 .2 -sSf https: //sh.rustup.rs | sh terminal: bash-5.1$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh info: downloading installer Welcome to Rust! This will download and install the official compiler for the Rust programming lang...

Pulling the important data out of html using BeautifulSoup

Introduction  This tutorial introduces a small recipe to extract important textual content from a webpage using the Beautiful Soup web scrapper.  What is important in a webpage and what is not important? In an HTML page, there are some HTML tags we need to remove when extracting the data such as script tags, style tags, link tags, and some meta tags. The navbar and footer element content is also not much important. so we exclude those elements in our extraction process. Importing Libraries we import beautiful soup and python request module. import requests from bs4 import BeautifulSoup as bs Get the webpage content we use a simple webpage hosted on GitHub for this process. Click this link to look at the webpage. Let's get and load the webpage content to a  BeautifulSoup  object. page = requests.get( "https://gayan830.github.io/bs_tutorial/fruits_vegetables.html" ) soup = bs(page. content ) print (soup.prettify() ) output: ...