Python’s Magic Methods: Leverage Their Power in Your Classes

As a Python developer who wants to harness the power of object-oriented programming, you’ll love to learn how to customize your classes using special methods, also known as magic methods or dunder methods. A special method is a method whose name starts and ends with a double underscore. These methods have special meanings for Python. Python automatically calls magic methods as a response to certain operations, such as instantiation, sequence indexing, attribute managing, and much more. Magic methods support core […]

Read more

HTTP Requests With Python’s urllib.request

If you need to perform HTTP requests using Python, then the widely used Requests library is often the way to go. However, if you prefer to use only standard-library Python and minimize dependencies, then you can turn to urllib.request instead. In this video course, you’ll: Learn the essentials of making basic HTTP requests with urllib.request Explore the inner workings of an HTTP message and how urllib.request represents it Grasp the concept of handling character encodings in HTTP messages Understand common […]

Read more

Python’s Array: Working With Numeric Data Efficiently

When you start your programming adventure, one of the most fundamental concepts that you encounter early on is the array. If you’ve recently switched to Python from another programming language, then you might be surprised that arrays are nowhere to be found as a built-in syntactical construct in Python. Instead of arrays, you typically use lists, which are slightly different and more flexible than classic arrays. That said, Python ships with the lesser-known array module in its standard library, providing […]

Read more

Add Logging and Notification Messages to Flask Web Projects

After implementing the main functionality of a web project, you may find that your app is rough around the edges. Often, this boils down to the user experience (UX) of your project. For example, when you send a form, you don’t receive a success message, although everything worked fine. You want to build an immersive experience, but wrong URLs display unwelcoming error messages. Luckily, you can get valuable information from Flask through logging. As an admin of a web project, […]

Read more

How many CPU cores can you actually use in parallel?

When you’re running a CPU-intensive parallel program, you often want to have a thread or process pool sized by the number of CPU cores on your machine. Fewer threads and you’re not taking advantage of all the cores, more than that and your program will start running slower as multiple threads compete for the same core. Or that’s the theory, anyway. So how do you check how many cores your computer has? And is this actually good advice? It turns […]

Read more

Python Basics Exercises: Reading and Writing Files

Files play a key role in computing, as they store and transfer data. You likely come across numerous files on a daily basis. In Python Basics: Reading and Writing Files, you dove into the world of file manipulation using Python. In this video course, you’ll practice: Differentiating between text and binary files Using character encodings and line endings Manipulating file objects in Python Reading and writing character data with different file modes Using open(), Path.open(), and the with statement Leveraging […]

Read more

Enhance Your Flask Web Project With a Database

Adding a database to your Flask project comes with many advantages. By connecting a database, you’ll be able to store user information, monitor user interactions, and maintain dynamic site content. By the end of this tutorial, you’ll have a robust understanding of how to connect your Flask app to a database and how to leverage this connection to expand your project’s capabilities. Prerequisites You’ll gain the most value from this tutorial if you’ve already created one or more Flask web […]

Read more

Build a Scalable Flask Web Project From Scratch

Flask is a powerful and flexible micro web framework for Python, ideal for both small and large web projects. It provides a straightforward way to get a web application up and running, with all the features that you need to get started. Over the course of this tutorial, you’ll explore the process of creating a boilerplate for a Flask web project. This boilerplate will serve as a great starting point for any scalable Flask web app that you wish to […]

Read more

Python Basics Exercises: Strings and String Methods

In Python Basics: Strings and String Methods, you used strings for text data in Python. You also learned how to manipulate strings with string methods. For example, you changed strings from lowercase to uppercase, removed whitespace from the beginning or end of a string, and replaced parts of a string with different text. In this video course, you’ll practice: Manipulating strings with string methods Working with user input Dealing with strings of numbers Formatting strings for printing This video course […]

Read more

Python News: What’s New From November 2023

November brought exciting news to the Python community, from PyPI’s first security audit to a new version of PyScript! The month also gave Python developers like you ample opportunities to get involved in the ecosystem through the annual Python Developers Survey and the PyCon US call for proposals. Development has also continued on Python 3.13 and Pydantic. Get ready to explore the recent highlights! PyPI Completes First Security Audit With the support of the Open Technology Fund (OTF), the Python […]

Read more
1 83 84 85 86 87 913