Python tutorials

Django View Authorization: Restricting Access

Django provides tools for both authentication and authorization. Django view authorization is typically done with decorators. This course will show you how to use these view decorators to enforce authorized viewing of pages in your Django site. By the end of this course you’ll know how to: Use HttpRequest and HttpRequest.user objects Authenticate and authorize users Differentiate between regular, staff, and admin users Secure a view with the @login_required decorator Restrict a view to different roles with the @user_passes_test decorator […]

Read more

Python: Check if Array/List Contains Element/Value

Introduction In this tutorial, we’ll take a look at how to check if a list contains an element or value in Python. We’ll use a list of strings, containing a few animals: animals = [‘Dog’, ‘Cat’, ‘Bird’, ‘Fish’] Check if List Contains Element With for Loop A simple and rudimentary method to check if a list contains an element is looping through it, and checking if the item we’re on matches the one we’re looking for. Let’s use a for […]

Read more

Python: Check if Variable is a List

Introduction Python is a dynamically typed language, and the variable data types are inferred without explicit intervention by the developer. If we had code that needed a list but lacked type hints, which are optional, how can we avoid errors if the variable used is not a list? In this tutorial, we’ll take a look at how to check if a variable is a list in Python, using the type() and isinstance() functions, as well as the is operator: Developers […]

Read more

Python: Check if Variable is a String

Introduction Python is a dynamically typed language, and the variable data types are inferred without explicit intervention by the developer. If we had code that requires a string to work correctly but lacked type hints, which are optional, how can we avoid errors if the variable used is not a string? In this tutorial, we’ll take a look at how to check if a variable is a string in Python, using the type() and isinstance() functions, as well as the […]

Read more

Seaborn Line Plot – Tutorial and Examples

Introduction Seaborn is one of the most widely used data visualization libraries in Python, as an extension to Matplotlib. It offers a simple, intuitive, yet highly customizable API for data visualization. In this tutorial, we’ll take a look at how to plot a Line Plot in Seaborn – one of the most basic types of plots. Line Plots display numerical values on one axis, and categorical values on the other. They can typically be used in much the same way […]

Read more

New Features: Article Bookmarks, Completion Status, and Search Improvements

With close to 2,000 Python tutorials and video lessons in the Real Python content library, it was getting harder and harder for learners to find the right resources at the right time. To fix that, we’ve just launched out several new features to help you easily find and review the learning resources you’re looking for. Here’s what’s new: Article Completion Status and Bookmarks Just like with courses and course lessons, you can now bookmark written tutorials and mark them as […]

Read more

Navigating Namespaces and Scope in Python

In a program of any complexity, you’ll create hundreds or thousands of names, each pointing to a specific object. How does Python keep track of all these names so that they don’t interfere with one another? This course covers Python namespaces, the structures used to organize the symbolic names assigned to objects in a Python program. In this course, you’ll learn: How Python organizes symbolic names and objects in namespaces When Python creates a new namespace How namespaces are implemented […]

Read more

Beginners Guide to Regular Expressions in Natural Language Processing

Introduction Regular Expressions is very popular among programmers and can be applied in many programming languages like Java, JS, php, C++, etc. Regular Expressions are useful for numerous practical day-to-day tasks that a data scientist encounters. It is one of the key concepts of Natural Language Processing that every NLP expert should be proficient in. Regular Expressions are used in various tasks such as data pre-processing, rule-based information mining systems, pattern matching, text feature engineering, web scraping, data extraction, etc. […]

Read more

Serializing Objects With the Python pickle Module

As a developer, you may sometimes need to send complex object hierarchies over a network or save the internal state of your objects to a disk or database for later use. To accomplish this, you can use a process called serialization, which is fully supported by the standard library thanks to the Python pickle module. In this course, you’ll learn: What it means to serialize and deserialize an object Which modules you can use to serialize objects in Python Which […]

Read more

Django Admin Customization

The Django framework comes with a powerful administrative tool called admin. You can use it out of the box to quickly add, delete, or edit any database model from a web interface. But with a little extra code, you can customize the Django admin to take your admin capabilities to the next level. In this course, you’ll learn how to: Add attribute columns in the model object list Link between model objects Add filters to the model object list Make […]

Read more
1 126 127 128 129 130 181