Build Website with Flask – Part 4

This is part of our Flask series: Build Website with Flask – Part 1 Build Website with Flask – Part 2 Build Website with Flask – Part 3 Build Website with Flask – Part 4 Build Website with Flask – Part 5 Build Website with Flask – Part 6 Build Website with Flask – Part … Read more

How to Fix “ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()”

Here’s an error I recently encountered when working with NumPy arrays: If you run the following code, you’ll experience a special ValueError: The output will be this error message: How can you fix this error? I’ll give you a short and a long answer to this question. Let’s start with the short one: Solution: Use … Read more

Python Map to Int

Problem Formulation Convert a string list to an integer list using the map() function. Example: Input: [‘1’, ‘2’, ‘3’] Output: [1, 2, 3] Input: [’42’] Output: [42] Input: [‘-1’, ‘-2’, ‘-3’] Output: [-1, -2, -3] Solution Using Map To convert a list of strings to a list of integers, you can “map to int” by … Read more

Python os.walk() – A Simple Illustrated Guide

According to the Python version 3.10.3 official doc, the os module provides built-in miscellaneous operating system interfaces. We can achieve many operating system dependent functionalities through it. One of the functionalities is to generate the file names in a directory tree through os.walk(). If it sounds great to you, please continue reading, and you will … Read more

¿Cómo convertir una lista en un array de NumPy?

Para convertir una lista de Python en un array de NumPy, usa cualquiera de los siguientes dos métodos: La función np.array() que toma un iterable y devuelve un array de NumPy creando una nueva estructura de datos en memoria. La función np.asarray() que toma un iterable como argumento y lo convierte al array. La diferencia … Read more

If Sin Else en una Línea de Python

Crear hermosas sentencias de una línea en Python es tanto un arte como una ciencia. En este tutorial, aprenderás a comprimir una sentencia if sin una cláusula else en una sola línea de código de Python. Problema: ¿Cuál es el equivalente de una sola línea de la sentencia if simple sin una cláusula else? Aquí … Read more

Cómo determinar el tipo de un objeto en Python

Planteamiento del problema Cada objeto de Python es de un cierto tipo, también llamado “clase”. La clase es un esquema que muestra los datos y capacidades de cada objeto/instancia que se crea a partir de este esquema. Dado un objeto de Python (=instancia). ¿Cómo determinar/comprobar/obtener su tipo (=clase)? Hay muchas variantes de esta pregunta: Cómo … Read more

Spring Developer – Income and Opportunity

Before we learn about the money, let’s get this question out of the way: What Is Spring? Let’s have a look at the definition from the official website (highlights by me): “The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications – on any kind of deployment platform. A key … Read more

Angular Developer – Income and Opportunity

Before we learn about the money, let’s get this question out of the way: What Is Angular? Let’s have a look at the definition from the official website (highlights by me): “Angular is a web development platform, built on TypeScript. […] With Angular, you’re taking advantage of a platform that can scale from single-developer projects … Read more

Django Developer – Income and Opportunity

Before we learn about the money, let’s get this question out of the way: What Is Django? Let’s have a look at the definition from the official website (highlights by me): “Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much … Read more