Python is a high-level, general-purpose programming language with emphasis on code readability. It supports various programming paradigms, for example, structured, object-oriented, and functional programming. Oftentimes, Python is described as “batteries included”, thanks to its comprehensive standard library. In this guide, we are going to learn various ways of removing whitespaces from a string in Python. Prerequisites To perform the steps …
Containerize A Python App using Docker
Docker is a free and open-source solution for developing, deploying, and managing apps in lightweight, OS-level virtualization. In this guide, we will demonstrate creating a Python app within a Docker container. Prerequisites To perform the steps demonstrated in this guide, you will need the following components: A Linux system. Check out configuring your own Ubuntu VPS on CloudSigma. The latest …
Defining Functions in Python 3: A Tutorial
In programming, a function is described as a block of instructions that can perform a certain action. A function is generally re-usable. Using functions makes the code more modular. It also opens up the opportunity of re-using the code over and over again in the future. Python is a robust programming language that supports functions. It already comes with a …
Writing Modules in Python 3: A Tutorial
Introduction Python is one of the most commonly used programming languages across the world. Modules are a critical part of the Python code. A module is simply a .py file in the context of Python 3. This means that you can refer to any Python file as a module. It is possible for you to obtain these modules through the …
Python 3 Tutorial: Indexing and Slicing Strings
Introduction Python is one of the most popular programming languages across the world. It uses a data type that comprises sequences made up of individual characters. These characters may be letters, numbers, symbols, or whitespace characters. Other types of sequence-based data types include lists and tuples. Just like them, you can also access, index, and slice strings in Python. In …
Using *args and **kwargs Parameters in your Code: a Python 3 Tutorial
Introduction Python is one of the most popular programming languages worldwide. In Python, parameters are a part of function definitions. They enable you to specify certain arguments for a function. The argument can be accepted and applied by the function. However, it is not possible for you to know at the time of coding what exact use cases may be …
The txt File Format: Working with Plain Text Files in Python 3
Introduction One of the primary functions of programming languages is to help you deal with data. This includes data writing, reading, storage, as well as transfer. Python is one of the most popular programming languages. If you are planning to use Python, you should have a basic idea of how to use different file types. The simplest of file types …
Importing Modules in Python 3: A Comprehensive Guide
Introduction Most of us are familiar with Python as a programming language. One of the great things about Python 3 is the myriad of built-in functions it offers. You get access to these functions when you are using Python 3 to write different types of code. Before we start, take a look at our tutorial on installing Python 3 and …
Programming with Python 3: How To Go About Constructing Classes and Defining Objects?
Introduction We all know about Python as a programming language. To be more specific, Python is an object-oriented programming language. In object-oriented programming, or OOP, the goal is to make reusable code patterns. This is different from procedural programming where we give a sequence of instructions. Object-oriented code is especially useful when you are working on complex programs. When you …
How to Crawl a Web Page with Scrapy and Python 3
Web scraping, web crawling, web harvesting, or web data extraction are synonyms referring to the act of mining data from web pages across the Internet. Web scrapers or web crawlers are tools that go over web pages programmatically extracting the required data. These data, which is usually large sets of text can be used for analytical purposes, to understand products, …
Using Python 3 String Formatters
Introduction The str.format() method in the string class of Python lets you do a variety of value formatting and substitution. Positional formatting and concatenation of elements within a string are done using string formatters in Python 3. In this tutorial, you will learn about the common uses of string formatters in Python. Formatting the strings will help you write more …
Python 3: A Guide on Converting Data Types
Introduction Python is a programming language that is often used for system integration purposes. This language uses something called ‘data types’. These data types help classify or define a given type of data. This means that a particular data type pertains to specific values and operations that you can apply to it. Each data type is programmed and edited in …