How To Extract All Emojis From Text in Python?

Summary: This blog explains the various ways one can extract commonly used Emojis embedded within text. Note: All the solutions provided below have been verified using Python 3.9.0b5. Problem Formulation One has a list with normal text words and emojis, all mixed together, as shown below.  How does one extract only the emojis, into a … Read more

Python memoryview() — Tame That Strange Beast!

The Python memoryview(arg) function returns a memoryview object of the given bytes or bytearray argument. This exposes the argument’s internal data (buffers) to help you access the data without intermediate copying. Syntax: memoryview(object) Arguments object Bytes or Bytearray object for which the memoryview should be returned Return Value memoryview Returns memoryview of the object. Python … Read more

Python hex() Function — Not a Magic Trick

Python’s built-in hex(integer) function takes one integer argument and returns a hexadecimal string with prefix “0x”. If you call hex(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

NumPy arange(): A Simple Illustrated Guide

The np.arange() function appears in 21% of the 35 million Github repositories that use the NumPy library! This illustrated tutorial shows you the ins and outs of the NumPy arange function. So let’s get started! What’s the NumPy Arange Function? The np.arange([start,] stop[, step]) function creates a new NumPy array with evenly-spaced integers between start … Read more