Scipy Interpolate 1D, 2D, and 3D

In this article we will explore how to perform interpolations in Python, using the Scipy library. Scipy provides a lot of useful functions which allows for mathematical processing and optimization of the data analysis. More specifically, speaking about interpolating data, it provides some useful functions for obtaining a rapid and accurate interpolation, starting from a … Read more

ASCII Table

The following table is an ASCII character table that translates different character codes—such as obtained by Python’s char() function— into the respective symbol. You can find the source of the description here. Note that you can define each number using the decimal, binary, octal, or hexadecimal system—it’s always the same value! Decimal Binary Octal Hexadecimal … Read more

Parsing XML Using BeautifulSoup In Python

Introduction XML is a tool that is used to store and transport data. It stands for eXtensible Markup Language. XML is quite similar to HTML and they have almost the same kind of structure but they were designed to accomplish different goals. XML is designed to transport data while HTML is designed to display data. … Read more

Python bin() Function

Python’s built-in bin(integer) function takes one integer argument and returns a binary string with prefix “0b”. If you call bin(x) on a non-integer x, it must define the __index__() method that returns an integer associated to x. Otherwise, it’ll throw a TypeError: object cannot be interpreted as an integer. Argument integer An integer value or … Read more

Python Re Escape

If you’re like me, you’ll regularly sit in front of your code and wonder: how to escape a given character? Challenge: Some characters have a special meaning in Python strings and regular expressions. Say you want to to search for string “(s)” but the regex engine takes the three characters (s) as a matching group. … Read more

Python ascii() Function

Python’s built-in ascii(object) function takes one object argument and returns the string representation of that object. The function calls the repr() built-in function and replaces non-ASCII characters with the character code \x. For example, calling ascii(‘München’) results in the ascii string ‘M\xfcnchen’ by replacing character ü with character code \xfc. Argument object Iterable such as … Read more

Installing Beautiful Soup

Summary: To install BeautifulSoup in WIndows use the command: pip install beautifulsoup4. To install it in Linux use the command: sudo apt-get install python3-bs4. Aim: In this tutorial we will discuss how to to install BeautifulSoup? Since BeautifulSoup is not a Python standard library we need to install it before we can use it to … Read more

Premature Optimization is the Root of All Evil

This chapter draft is part of my upcoming book “The Art of Clean Code” (NoStarch 2022). You’ll learn about the concept of premature optimization and why it hurts your programming productivity. Premature optimization is one of the main problems of poorly written code. But what is it anyway? Definition Premature Optimization Definition: Premature optimization is … Read more

Как проверить вашу версию Python? Полезное руководство.

Для проверки версии Python, запустите python –version в командной строке (Windows), оболочке (Mac) или терминале (Linux / Ubuntu). Чтобы проверить версию Python в скрипте, запустите import sys, чтобы импортировать модуль, и используйте sys.version, чтобы получить подробную информацию о версии в коде. Давайте кратко рассмотрим различные способы проверки версии Python во всех операционных системах и средах. … Read more