pyguides

Tutorials

Python Tutorials

Step-by-step series to learn Python from scratch.

Intermediate Python

10 tutorials

  1. Regular Expressions in Python

    Learn how to use regular expressions in Python with the re module. Cover pattern matching, groups, and practical examples for validating and extracting text.

  2. Working with Dates and Times

    Learn how to handle dates and times in Python using the datetime module. Covers datetime, date, time, timedelta, timezones, and practical examples.

  3. Debugging Python with pdb

    Master debugging Python with pdb — set breakpoints, step through code, inspect variables, and use post-mortem debugging to find and fix bugs faster.

  4. Testing Your Code with pytest

    Learn how to write and run tests in Python using the pytest framework. Covers test functions, assertions, fixtures, parametrization, mocking, and best practices

  5. Type Hints and Static Analysis with mypy

    Learn how to use type hints and mypy to catch bugs before runtime. This tutorial covers adding type annotations, running mypy, and fixing common type errors.

  6. Concurrency with threading

    Learn how to use Python's threading module to run multiple tasks concurrently. Covers creating threads, locks, and when to use threading vs multiprocessing.

  7. Parallelism with multiprocessing

    Learn how to use Python's multiprocessing module to run code in parallel using multiple processes, bypassing the GIL for CPU-bound tasks

  8. Async Programming with asyncio

    Learn asynchronous programming in Python with asyncio. Master async/await syntax, coroutines, tasks, and run concurrent operations efficiently.

  9. Packaging and Publishing a Python Library

    Learn how to package your Python code and publish it to PyPI so others can install it with pip.

  10. Pattern Matching with match/case

    Learn how to use Python's match statement for structural pattern matching, covering literals, sequences, classes, mappings, and guards

Python and Data

3 tutorials

  1. Making HTTP Requests and Working with APIs

    Learn how to make HTTP requests in Python using the requests library, handle responses, and work with REST APIs

  2. Databases and SQLite in Python

    Learn how to use SQLite databases in Python with the sqlite3 module. Covers creating databases, tables, and all CRUD operations with practical examples.

  3. CSV Files to Data Analysis

    Learn how to read, parse, and analyze CSV files in Python using the csv module and pandas. Covers reading, filtering, sorting, and basic data analysis.

Python Async

6 tutorials

  1. asyncio Basics: Event Loops and Coroutines

    Learn asyncio fundamentals: how event loops work, what coroutines are, and how to run async code in Python.

  2. Async Patterns: Gather, Wait, and Queues

    Master asyncio.gather(), asyncio.wait(), and asyncio.Queue to handle concurrent async tasks in Python.

  3. Async HTTP with aiohttp

    Make asynchronous HTTP requests in Python using aiohttp: sessions, timeouts, connection pooling, and error handling.

  4. Async File I/O with aiofiles in Python

    Learn to read and write files asynchronously in Python using aiofiles, without blocking the asyncio event loop or your application's concurrency.

  5. Task Groups and Exception Handling

    asyncio task groups with ExceptionGroup and except* in Python 3.11+ — concurrent coroutines that succeed or fail as a unit, no orphaned tasks.

  6. Structured Concurrency in Python

    Structured concurrency in Python: how asyncio.TaskGroup, asyncio.timeout, and ExceptionGroup compose into a lifetime-safe model on 3.11+.

Python Automation

3 tutorials

  1. Scheduled Tasks in Python

    Learn how to schedule Python scripts to run automatically using cron, APScheduler, Celery Beat, and more. Step-by-step tutorial with practical examples.

  2. Browser Automation with Playwright

    Control browsers with Playwright from Python: install, find elements, fill forms, assert state, intercept network calls, and integrate with pytest.

  3. Email Automation with Python

    Learn to send, read, and manage emails programmatically using Python's smtplib, imaplib, and popular third-party libraries.

Python CLI

3 tutorials

  1. Building Command-Line Interfaces with Click in Python

    Build CLIs with Python's Click library. Define commands with decorators, handle options and arguments, validate input, and compose multi-command interfaces.

  2. Modern CLIs with Typer

    Build elegant command-line interfaces using Python type hints with Typer, built on Click.

  3. Building Installable CLI Tools

    Learn how to create Python command-line tools that users can install with pip, using pyproject.toml entry points and argparse.

Python Devops

3 tutorials

  1. Running Shell Commands from Python

    Learn how to run shell commands from Python using the subprocess module, handle output, manage processes, and avoid common security pitfalls.

  2. SSH Automation with Paramiko in Python

    Learn how to automate SSH connections and remote command execution in Python using Paramiko, the pure-Python SSH library.

  3. Automating AWS Services with Boto3 in Python

    Learn how to automate AWS services using Boto3, the official AWS SDK for Python. Covers S3, EC2, and common automation patterns.

Python for Finance

5 tutorials

  1. Python for Finance: Getting Started

    Learn the fundamentals of financial analysis with Python — setting up your environment, working with data, and performing your first stock analysis

  2. Fetching Stock Data with yfinance

    Learn how to download and analyze stock market data using Python's yfinance library.

  3. Calculating Returns and Volatility

    Learn how to calculate simple and log returns, annualized returns, and volatility measures for stock data analysis using Python

  4. Portfolio Analysis in Python

    Learn how to analyze investment portfolios using Python — calculate returns, volatility, Sharpe ratio, and visualize performance

  5. Backtesting a Simple Strategy

    Learn how to backtest trading strategies in Python — build a moving average crossover strategy and analyze key performance metrics

Python Fundamentals

15 tutorials

  1. Installing Python on Your Computer

    Learn how to download and install Python on Windows, macOS, and Linux, verify your installation, and launch the interactive REPL.

  2. Getting Started with Python

    Write and run your first Python script, use the interactive REPL, and learn about print(), comments, strings, and numbers.

  3. Python Basics: Variables, Types, and Operators

    Master Python basics: variables, data types, and operators with clear examples. See how dynamic typing and f-strings make everyday coding cleaner.

  4. Control Flow: if, for, and while in Python

    Master Python control flow with if/elif/else decisions, for and while loops, break and continue statements, and the loop else clause for cleaner program logic.

  5. Writing Functions in Python

    Master writing functions in Python — covers def, parameters, return values, scope, args and kwargs, docstrings, and best practices for clean reusable code.

  6. Lists, Tuples, and Dictionaries

    Learn how Python's lists, tuples, and dictionaries work so you can pick the right one every time. Covers indexing, slicing, unpacking, and iteration patterns.

  7. Working with Python Modules and Imports

    Organize Python code into modules and packages, master the import system, and use the standard library effectively for building maintainable applications.

  8. Python Classes and Objects: A Beginner's Guide to OOP

    Learn Python classes and objects from scratch. Covers constructors, instance attributes, methods, and self with practical inventory and bank account examples.

  9. Reading and Writing Files in Python

    Learn how to read from and write to files in Python using built-in functions and pathlib. Covers text and binary files, context managers, and common patterns.

  10. Handling Errors and Exceptions

    Master handling errors in Python with try/except blocks, custom exceptions, and production-ready patterns for building applications that fail gracefully.

  11. List, Dict, and Set Comprehensions

    Learn how to use list, dict, and set comprehensions in Python. Covers basic syntax, filtering, and nested loops.

  12. *args and **kwargs Explained

    Learn how to use *args and **kwargs in Python to write flexible functions that accept any number of positional and keyword arguments.

  13. How to Join a List into a String in Python

    Learn how to convert a list to a string in Python using str.join() with practical examples for different data types and separators.

  14. String Formatting with f-strings in Python

    Learn how to use f-strings to embed variables and expressions inside strings, format numbers with precision, and compare with other formatting methods

  15. Recursion in Python

    Learn how to write recursive functions in Python, understand base cases and recursive cases, and see practical examples like factorial and Fibonacci.

Python Output and Reporting

1 tutorial

  1. Generating PDFs in Python with ReportLab, fpdf2, and WeasyPrint

    Learn generating PDFs in Python with ReportLab, fpdf2, and WeasyPrint. Covers text, tables, charts, images, page layout, and in-memory generation for web apps.

Python Testing

7 tutorials

  1. pytest Basics: Writing Your First Python Tests with pytest

    Learn pytest basics for Python testing. Install pytest, write assertions, run test functions, and interpret output from the pytest runner step by step.

  2. pytest Fixtures and Parametrize

    pytest fixtures share setup across tests. Parametrize runs the same test against multiple inputs. Covers scopes, autouse, and combining.

  3. Mocking Python: Test Doubles, patch, and MonkeyPatch in pytest

    Learn mocking Python tests with unittest.mock, patch, and MonkeyPatch. Replace slow APIs, databases, and external services with controlled test doubles.

  4. Testing Async Code with pytest

    Test async functions and coroutines with pytest-asyncio. Use async fixtures, patch async code, and handle event loop scope correctly.

  5. Property-Based Testing with Hypothesis

    Write tests that verify behaviour across hundreds of automatically generated inputs, catching edge cases that example-based testing misses. Use Hypothesis to...

  6. Code Coverage and Mutation Testing

    Measure code coverage with Coverage.py, then use mutation testing to verify your tests actually catch bugs.

  7. pytest Test Organization Patterns

    Learn pytest test organization patterns including project structure, fixtures, and conftest for maintainable test suites.

Python Tooling

1 tutorial

  1. File Watching and Live Reload with watchfiles

    Learn how to monitor file system changes in Python using watchfiles. Automatically restart your processes, trigger builds, or refresh caches when files change.

Python Web Development

5 tutorials

  1. Flask Basics: Your First Web App

    Learn how to build a web app with Flask, from installation to running your first route. Covers templates, forms, and the request-response cycle.

  2. Django Basics: Models, Views, and Templates

    Learn Django fundamentals: set up a project, create models, build views, and design templates. A hands-on guide for beginners.

  3. Authentication with FastAPI

    Build a secure user authentication system with FastAPI using JWT tokens, password hashing, and dependency injection for protected routes.

  4. Handling Webhooks in Python

    Learn to receive, verify, and process webhooks in Python with Flask and FastAPI. Cover signature verification, security best practices, and real-world examples.

  5. Deploying Python Web Apps

    Learn how to deploy Python web applications to production servers. Covers hosting options, WSGI servers, reverse proxies, SSL, and deployment automation.

Scientific Python

11 tutorials

  1. Getting Started with NumPy

    Learn the fundamentals of NumPy arrays, creation, and basic operations.

  2. NumPy Array Operations

    Master essential NumPy array operations: element-wise operations, broadcasting, aggregations, and array manipulation.

  3. Getting Started with pandas

    Learn the fundamentals of pandas DataFrames, data loading, and basic data manipulation for analysis.

  4. Data Cleaning with pandas

    Master essential data cleaning techniques in pandas including handling missing values, removing duplicates, string cleaning, and data type conversions.

  5. Building a Data Cleaning Pipeline

    Chain pandas operations into a reusable data cleaning pipeline. Covers method chaining, pipe(), custom transformers, and production-ready ETL patterns.

  6. Plotting Data with Matplotlib

    Learn how to create stunning visualizations in Python with Matplotlib, from basic line plots to custom styling.

  7. scikit-learn Intro: Your First ML Model

    Build your first machine learning model with scikit-learn. Covers estimator pattern, fit/predict API, train-test splits, and a complete classification example.

  8. Scientific Computing with SciPy

    Learn how to use SciPy for optimization, interpolation, integration, and statistics.

  9. pandas Intro: DataFrames and Series

    Get started with pandas DataFrames and Series. Learn how to create, index, filter, and transform tabular data in Python with practical examples.

  10. Matplotlib Basics: Plots and Charts

    Create line plots, scatter charts, bar graphs, and histograms with Matplotlib. Learn the pyplot interface, figure management, and basic customization.

  11. Data Visualization with Seaborn

    Create statistical charts with Seaborn: scatter plots, bar charts, histograms, box plots, and heatmaps. Built on matplotlib with sensible defaults.