Why you should use the dataclass from python
Python provides us with a useful module called dataclasses. If the primary purpose of your class is just to store data, then you should definitely consider using the dataclasses module from python. Why should you use it? The key advantage of using a dataclass is that it automatically creates all the dunder methods for you…
Plotting graphs using python and Matplotlib
This article focuses on plotting different types of graphs such as line charts, bar charts, pie charts, and scatter plots using Matplotlib, which is arguably the most popular graphing and data visualization library for Python. Graphs are mathematical structures that represent pairwise relationships between objects. Matplotlib Matplotlib is a comprehensive library…
Find IP address and location using python
In this article, we shall see how to fetch the IP address of the user using python with the help of the built-in requests module. What is the request module in python? The requests module allows you to send HTTP requests like GET, POST, PUT and DELETE using Python. …
Cool things you can do with map in python
What is a map() function? The map() function will take two arguments one a function and another an iterable (list, tuple, etc), and performs the function passed to each item of the iterable and returns a map object. The map object can take different types of functions. They are A normal function A lambda function …
Get system information using python
Python provides a built-in module called “platform” that enables us to fetch some of the information about our system such as OS, processor, system version, etc Let us look at some of the methods one by one with an example for each 1. Machine type The machine() method returns the machine type of…
Push your code to the remote Git branch
If you wish to push the code in your local computer system to a particular branch in remote, then this article is for you. Follow the steps below. Add a .gitgnore file [The files and directories mentioned in this file will not be pushed to the remote] touch .gitignore 2. Initialise git. This command will add a .git file to your local directory git init 3. Add the files to be committed to the remote code
If you wish to push the code in your local computer system to a particular branch in remote, then this article is for you. Follow the steps below.
- Add a .gitgnore file [The files and directories mentioned in this file will not be pushed to the remote]
2. Initialise git. This command will add a .git file to your local directory
3. Add the files to be committed to the remote code
git add .
4. Add a commit message
git commit -m "Initial commit"
5. Add it to the remote repository
git remote add origin firstname.lastname@example.org:/path/to/my_project.git
6. Push it to the master
git push origin master
7. If you wish to push it to some other branch instead of master, run the following command.
git push origin HEAD:<your_branch_name>
Disadvantages of Flask
Flask is a micro-framework written in python. Flask is based on the Werkzeug WSGI toolkit and Jinja2 template engine. It is called a micro framework because it does not require tools or libraries. Flask supports various extensions that can add additional functionalities. Few applications that use flask are Pinterest LinkedIn …
String constants in python
The string module has some of the built-in constant variables. We can use this instead of declaring the constants again in our code. Some of the string constants that will be discussed here are, ascii_letters ascii_lowercase ascii_uppercase octdigits punctuation whitespace Let us look at these constants one by one with…