Get AI summaries of any video or article — Sign up free

Corey Schafer — Channel Summaries

AI-powered summaries of 140 videos about Corey Schafer.

140 summaries

No matches found.

Python OOP Tutorial 1: Classes and Instances

Corey Schafer · 2 min read

Python’s class system is presented as a practical way to bundle related data and behavior into reusable blueprints—especially when you need many...

Object-Oriented ProgrammingClassesInstances

Python Tutorial for Beginners 1: Install and Setup for Mac and Windows

Corey Schafer · 2 min read

Getting Python running on your computer is the whole point of this beginner setup walkthrough—and it’s handled separately for Mac and Windows, then...

Python InstallationmacOS SetupWindows PATH

Python Django Tutorial: Full-Featured Web App Part 1 - Getting Started

Corey Schafer · 2 min read

Django’s “batteries-included” setup lets developers go from a blank machine to a working web server with almost no custom code—then build toward a...

Django SetupProject ScaffoldingURL Routing

Git Tutorial for Beginners: Command-Line Fundamentals

Corey Schafer · 3 min read

Git command-line fundamentals hinge on one practical advantage: distributed version control keeps a full copy of repository history on every...

Distributed Version ControlGit InstallationLocal Repository Workflow

Jupyter Notebook Tutorial: Introduction, Setup, and Walkthrough

Corey Schafer · 3 min read

Jupyter Notebooks turn code, results, plots, and explanations into a single interactive document—so users can run computations in small steps, see...

Jupyter Notebooks SetupKernels and Execution OrderMarkdown and Cell Modes

Python Tutorial: if __name__ == '__main__'

Corey Schafer · 2 min read

The line `if __name__ == '__main__':` is a gatekeeper in Python that decides whether a file is being executed directly or merely imported, letting...

__name__ variableMain GuardModule Import

Python Flask Tutorial: Full-Featured Web App Part 1 - Getting Started

Corey Schafer · 2 min read

Flask is set up as a practical path to building a full-featured blog-style web app—complete with user registration and login, password reset emails,...

Flask SetupRoutingDebug Mode

Python Tutorial: File Objects - Reading and Writing to Files

Corey Schafer · 2 min read

Python file objects hinge on two practical choices: opening files in the right mode and managing their lifecycle safely. Using open() without cleanup...

File ModesContext ManagersReading Strategies

Python Tutorial for Beginners 2: Strings - Working with Textual Data

Corey Schafer · 3 min read

Python strings are the core way Python represents textual data, and the practical skill is learning how to define them safely, inspect them, and...

StringsQuoting RulesIndexing and Slicing

Python OOP Tutorial 2: Class Variables

Corey Schafer · 2 min read

Class variables let one shared value live on a class and be reused across every instance—perfect for data that should stay consistent company-wide,...

Class VariablesInstance VariablesAttribute Lookup

Python Tutorial for Beginners 5: Dictionaries - Working with Key-Value Pairs

Corey Schafer · 2 min read

Python dictionaries store data as key–value pairs, letting programmers look up values by a unique key—similar to how a physical dictionary maps words...

DictionariesKey-Value PairsDictionary Methods

Python Tutorial for Beginners 4: Lists, Tuples, and Sets

Corey Schafer · 3 min read

Python lists, tuples, and sets differ most in how they handle order, duplicates, and mutability—and those differences drive the right choice of data...

ListsTuplesSets

Python OOP Tutorial 3: classmethods and staticmethods

Corey Schafer · 2 min read

Class methods and static methods solve two different problems in Python class design: class methods let code operate on shared class-level state (and...

Class MethodsStatic MethodsAlternative Constructors

Python Pandas Tutorial (Part 1): Getting Started with Data Analysis - Installation and Loading Data

Corey Schafer · 3 min read

Pandas is positioned as a practical entry point for Python-based data analysis—especially for working with CSV and Excel-style datasets—because it...

Pandas InstallationJupyter Notebook SetupLoading CSV Data

Python Tutorial: Unit Testing Your Code with the unittest Module

Corey Schafer · 3 min read

Unit testing in Python with the built-in `unittest` module is presented as a practical way to catch breakages during refactoring and...

Unit Testingunittest ModuleAssertions

Python OOP Tutorial 4: Inheritance - Creating Subclasses

Corey Schafer · 2 min read

Python inheritance lets developers build specialized subclasses that reuse a parent class’s attributes and methods, then selectively override or...

Class InheritanceMethod Resolution OrderOverriding Class Attributes

Python Tutorial: CSV Module - How to Read, Parse, and Write CSV Files

Corey Schafer · 2 min read

CSV files store structured data as plain text, typically using a delimiter like commas to separate fields on each line. A header row names the...

CSV ParsingCSV ReadingCSV Writing

Regular Expressions (Regex) Tutorial: How to Match Any Pattern of Text

Corey Schafer · 3 min read

Regular expressions let people search text by pattern, not by exact wording—turning messy, variable data (like phone numbers, emails, and URLs) into...

Regex BasicsMeta CharactersCharacter Classes

Python Tutorial for Beginners 8: Functions

Corey Schafer · 3 min read

Functions in Python are reusable blocks of instructions defined with `def` that can take inputs (parameters) and optionally produce outputs (return...

Python FunctionsReturn ValuesParameters Defaults

Python Tutorial: Working with JSON Data using the json Module

Corey Schafer · 2 min read

JSON handling in Python hinges on two core moves: converting JSON strings/files into native Python objects with `json.loads`/`json.load`, and...

JSON ParsingPython json ModuleLoading JSON Strings

Python Tutorial: re Module - How to Write and Match Regular Expressions (Regex)

Corey Schafer · 3 min read

Regular expressions in Python become practical once you learn how to (1) pass patterns safely into `re`, (2) interpret matches via spans and groups,...

Regular ExpressionsPython re ModuleRegex Meta-Characters

Python Tutorial: Web Scraping with BeautifulSoup and Requests

Corey Schafer · 2 min read

Web scraping becomes practical when HTML structure is treated like a map: fetch a page with `requests`, parse it with BeautifulSoup, then extract...

Web ScrapingBeautifulSoupRequests

Python Tutorial: Anaconda - Installation and Using Conda

Corey Schafer · 3 min read

Anaconda is pitched as a practical shortcut for getting a working Python data-science setup—complete with common libraries, environment management,...

Anaconda InstallationConda Package ManagerConda Environments

Matplotlib Tutorial (Part 1): Creating and Customizing Our First Plots

Corey Schafer · 3 min read

Matplotlib is positioned as a practical way to turn Python data into clear, customizable charts—starting with a basic line plot and quickly layering...

Matplotlib BasicsLine PlotsPlot Customization

Python Requests Tutorial: Request Web Pages, Download Images, POST Data, Read JSON, and More

Corey Schafer · 2 min read

Requests is positioned as the go-to Python library for making HTTP requests—fetching web pages, downloading images, sending POST data, and reading...

HTTP RequestsPython RequestsWeb Scraping

Setting up a Python Development Environment in Sublime Text

Corey Schafer · 2 min read

Setting up a Python workflow in Sublime Text hinges on three layers: installing Package Control, applying editor-wide preferences (themes, fonts, and...

Sublime Text SetupPython Build SystemsPackage Control

Python OOP Tutorial 6: Property Decorators - Getters, Setters, and Deleters

Corey Schafer · 2 min read

Property decorators in Python let class attributes behave like computed fields—readable like normal attributes, while still backed by methods that...

Property DecoratorsGettersSetters

Python SQLite Tutorial: Complete Overview - Creating a Database, Table, and Running Queries

Corey Schafer · 2 min read

SQLite in Python can be set up with almost no infrastructure: import the built-in `sqlite3` module, connect to a disk-backed database file (or an...

SQLite BasicsDatabase ConnectionsSQL Table Creation

Python Tutorial for Beginners 7: Loops and Iterations - For/While Loops

Corey Schafer · 2 min read

Loops and iterations in Python come down to two core tools: for loops that step through values, and while loops that keep running until a condition...

For LoopsWhile LoopsBreak and Continue

Python Tutorial: OS Module - Use Underlying Operating System Functionality

Corey Schafer · 2 min read

Python’s OS module gives direct, scriptable control over the operating system—letting code navigate the filesystem, create and delete folders, rename...

OS Module BasicsFilesystem NavigationRecursive Directories

Python Tutorial: Decorators - Dynamically Alter The Functionality Of Your Functions

Corey Schafer · 2 min read

Python decorators let developers change or extend a function’s behavior without rewriting the function itself. The core idea is that a decorator is a...

Python DecoratorsFirst-Class FunctionsClosures

Preparing for a Python Interview: 10 Things You Should Know

Corey Schafer · 3 min read

Core takeaway: entry-level Python interview preparation hinges less on memorizing trivia and more on being able to write correct Python from scratch...

Whiteboard CodingControl FlowPython Data Types

Python Tutorial for Beginners 9: Import Modules and Exploring The Standard Library

Corey Schafer · 3 min read

Importing Python modules hinges on two practical choices: how to reference code you wrote (or third-party code) and how to pull in built-in tools...

Module Importssys.pathPYTHONPATH

Python Tutorial for Beginners 3: Integers and Floats - Working with Numeric Data

Corey Schafer · 2 min read

Python’s numeric toolbox hinges on two core types—integers and floats—and the practical rules for operating on them. Integers represent whole numbers...

Integers vs FloatsArithmetic OperatorsModulo and Parity

Python Django Tutorial: Full-Featured Web App Part 3 - Templates

Corey Schafer · 2 min read

Django templates turn repetitive, full-page HTML strings in view functions into reusable HTML files—then let those pages receive dynamic data and...

Django TemplatesTemplate InheritancePassing Context

Python Flask Tutorial: Full-Featured Web App Part 2 - Templates

Corey Schafer · 2 min read

Flask templates turn messy, repeated HTML strings into maintainable web pages—and the biggest upgrade comes from template inheritance, which lets one...

Flask TemplatesJinja LoopsTemplate Inheritance

Python OOP Tutorial 5: Special (Magic/Dunder) Methods

Corey Schafer · 2 min read

Python’s “special” (magic/dunder) methods let custom classes behave like built-in types—changing how operations work and how objects display. Instead...

Dunder MethodsOperator Overloading__repr__ vs __str__

Python Tutorial: Generators - How to use them and the benefits you receive

Corey Schafer · 2 min read

Generators in Python trade “build everything first” for “produce values on demand,” using the yield keyword to stream results one at a time. That...

GeneratorsYield KeywordLazy Evaluation

Python Threading Tutorial: Run Code Concurrently Using the Threading Module

Corey Schafer · 2 min read

Threading in Python delivers real speedups when tasks spend most of their time waiting on input/output—like network requests—because threads overlap...

Threading vs MultiprocessingI/O Bound ConcurrencyThreadPoolExecutor

Python Django Tutorial: Full-Featured Web App Part 2 - Applications and Routes

Corey Schafer · 2 min read

Django’s routing model lets a single project host multiple independent apps—then stitches them together through URL configuration—so adding a blog...

Django AppsURL RoutingViews and HttpResponse

Python Tutorial: virtualenv and why you should use virtual environments

Corey Schafer · 2 min read

Virtual environments (virtualenv) let Python developers isolate dependencies per project, preventing package upgrades from breaking other...

Virtual EnvironmentsDependency Isolationpip freeze

Python Multiprocessing Tutorial: Run Code in Parallel Using the Multiprocessing Module

Corey Schafer · 3 min read

Multiprocessing speeds up Python workloads by running multiple tasks at the same time across separate processes—often cutting wall-clock time...

MultiprocessingProcessPoolExecutorThreading vs Multiprocessing

Python Tutorial: Using Try/Except Blocks for Error Handling

Corey Schafer · 2 min read

Python’s try/except structure lets developers replace ugly, user-facing tracebacks with controlled, readable error handling—while still catching only...

Try/Except Error HandlingFileNotFoundErrorelse Clause

Python Flask Tutorial: Full-Featured Web App Part 3 - Forms and User Input

Corey Schafer · 2 min read

Flask forms don’t have to be hand-built and fragile: WT Forms lets developers define registration and login inputs as Python classes, attach...

WT FormsFlask-WTFForm Validation

Python Tutorial for Beginners 6: Conditionals and Booleans - If, Else, and Elif Statements

Corey Schafer · 2 min read

Python conditionals let programs choose which blocks of code run based on whether expressions evaluate to True or False—an idea built on Python’s...

If StatementsElse and ElifBoolean Operators

Python Pandas Tutorial (Part 2): DataFrame and Series Basics - Selecting Rows and Columns

Corey Schafer · 3 min read

Pandas’ core data structures—DataFrame (2D) and Series (1D)—become much easier to work with once they’re treated like rows/columns containers rather...

DataFrame BasicsSeries BasicsColumn Selection

Visual Studio Code (Windows) - Setting up a Python Development Environment and Complete Overview

Corey Schafer · 3 min read

Visual Studio Code becomes a full Python workstation on Windows by pairing the built-in editor with the Python extension, then wiring it to the right...

Visual Studio Code SetupPython InterpreterVirtual Environments

Python Django Tutorial: Full-Featured Web App Part 5 - Database and Migrations

Corey Schafer · 2 min read

Django’s ORM turns database design into Python models, letting developers create real blog posts with zero hand-written SQL—then query, format, and...

Django ModelsDatabase MigrationsDjango ORM Queries

Python Flask Tutorial: Full-Featured Web App Part 4 - Database with Flask-SQLAlchemy

Corey Schafer · 2 min read

Flask-SQLAlchemy turns a Flask app’s database into Python classes—letting developers create real users and posts backed by SQLite in development,...

Flask-SQLAlchemy SetupSQLAlchemy ModelsOne-to-Many Relationships

Setting up a Python Development Environment in Atom

Corey Schafer · 2 min read

Atom is positioned as a free, GitHub-backed editor that can be turned into a practical Python workspace with a handful of packages—most importantly...

Atom SetupPython RunningCode Formatting

Python Django Tutorial: Full-Featured Web App Part 6 - User Registration

Corey Schafer · 2 min read

A complete Django user registration flow is built end-to-end: a dedicated “users” app, a register route and view, a template with CSRF protection,...

Django Users AppUser Registration ViewForm Validation

Python Tutorial: VENV (Windows) - How to Use Virtual Environments with the Built-In venv Module

Corey Schafer · 2 min read

Virtual environments solve a practical dependency problem: they let each project install its own Python packages without risking version conflicts in...

Virtual EnvironmentsPython venvWindows Activation

Python Tutorial: Datetime Module - How to work with Dates, Times, Timedeltas, and Timezones

Corey Schafer · 3 min read

Python’s datetime module is the backbone for working with dates, times, time deltas, and time zones—but the biggest practical hurdle is knowing when...

Naive vs Aware DatetimesTimedelta ArithmeticTime Zone Conversion with pytz

Python Tutorial: Comprehensions - How they work and why you should be using them

Corey Schafer · 2 min read

List comprehensions in Python let programmers build lists, dictionaries, and sets in a compact, readable way—often replacing longer, nested for-loops...

List ComprehensionsFilteringNested Comprehensions

Python Tutorial: Logging Basics - Logging to Files, Setting Levels, and Formatting

Corey Schafer · 2 min read

Python’s built-in logging module is presented as a practical upgrade from print statements: it lets developers capture what happened (including...

Logging Levelslogging.basicConfigFile Logging

Python Tutorial: Generate Random Numbers and Data Using the random Module

Corey Schafer · 2 min read

Python’s built-in `random` module makes it easy to generate realistic-looking dummy data—random numbers, random selections from lists, weighted...

Random ModuleRandom NumbersWeighted Choices

SQL Tutorial for Beginners 1: Installing PostgreSQL and Creating Your First Database

Corey Schafer · 2 min read

SQL’s value for beginners comes down to practicality: most software systems rely on databases, and SQL offers a relatively small set of core commands...

SQL SetupPostgreSQL InstallationDatabase Creation

Python Tutorial: Slicing Lists and Strings

Corey Schafer · 2 min read

Python slicing lets you extract parts of lists and strings using a compact syntax: start, end, and optional step (start:end:step). The core rule is...

List SlicingString SlicingNegative Indexing

Python Pandas Tutorial (Part 8): Grouping and Aggregating - Analyzing and Exploring Your Data

Corey Schafer · 3 min read

Grouping and aggregation in pandas turns a raw survey table into answers—like “What’s the median salary by country?” or “Which social networks are...

AggregationGroupbyValue Counts

Python Pandas Tutorial (Part 5): Updating Rows and Columns - Modifying Data Within DataFrames

Corey Schafer · 2 min read

Updating existing data in pandas DataFrames hinges on using the right indexing and transformation tools—especially to avoid the “SettingWithCopy”...

Updating ColumnsUpdating RowsPandas Indexing

Python Pandas Tutorial (Part 3): Indexes - How to Set, Reset, and Use Indexes

Corey Schafer · 2 min read

Pandas indexes turn row and column lookups from “search by position” into “search by label,” and that shift makes real survey data far easier to...

Pandas IndexingSetting IndexUsing .loc and .iloc

Python Tutorial: Automate Parsing and Renaming of Multiple Files

Corey Schafer · 2 min read

A practical Python script can fix messy, alphabetically sorted video filenames by renaming hundreds of files so they play in the intended numeric...

File RenamingPython ScriptingString Parsing

Python Flask Tutorial: Full-Featured Web App Part 6 - User Authentication

Corey Schafer · 2 min read

User authentication is built end-to-end: passwords are securely hashed with bcrypt at registration, duplicate usernames/emails are blocked with...

Password HashingWTForms ValidationFlask-Login Sessions

Python Tutorial: Image Manipulation with Pillow

Corey Schafer · 2 min read

Pillow turns Python into a practical image-processing tool, letting developers batch-display, convert, resize, and transform images without manual...

Pillow InstallationImage Format ConversionBatch Image Processing

Python Tutorial: Iterators and Iterables - What Are They and How Do They Work?

Corey Schafer · 2 min read

Iterables and iterators in Python boil down to two distinct contracts: an iterable can produce an iterator via its `__iter__` method, while an...

IterablesIteratorsPython Protocols

Programming Terms: Closures - How to Use Them and Why They Are Useful

Corey Schafer · 1 min read

Closures let an inner function keep access to variables from the scope where it was created—even after that outer scope has finished running. That...

ClosuresFirst-Class FunctionsPython

Python Tutorial: Variable Scope - Understanding the LEGB rule and global/nonlocal statements

Corey Schafer · 2 min read

Python variable scope hinges on where a name is defined and the order Python searches when code references that name. The practical takeaway is the...

Variable ScopeLEGB RuleGlobal Keyword

Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits

Corey Schafer · 2 min read

Undoing mistakes in Git comes down to choosing the right tool for the kind of error—and whether anyone else has already pulled the changes. The most...

Undoing Local ChangesAmending CommitsReset Modes

Linux/Mac Terminal Tutorial: The Grep Command - Search Files and Directories for Patterns of Text

Corey Schafer · 2 min read

Grep is a fast way to search for text patterns across files and directories from the Linux or Mac terminal, and mastering its options turns a simple...

Grep CommandText SearchRegular Expressions

Python Pandas Tutorial (Part 10): Working with Dates and Time Series Data

Corey Schafer · 2 min read

Working with date and time data in pandas starts with one non-negotiable step: converting your timestamp column from plain text into a real datetime...

Datetime ParsingTime Series FilteringResampling

Python Tutorial: Logging Advanced - Loggers, Handlers, and Formatters

Corey Schafer · 2 min read

Python’s logging becomes reliable only when each module uses its own logger and explicitly wires that logger to the right outputs. The core fix in...

Python LoggingLoggersHandlers

Linux/Mac Tutorial: SSH Key-Based Authentication - How to SSH Without a Password

Corey Schafer · 2 min read

SSH key-based authentication replaces password prompts with cryptographic login, making remote access both more convenient and more secure. The core...

SSH Key Authenticationssh-keygenauthorized_keys

How to Use ChatGPT as a Powerful Tool for Programming

Corey Schafer · 3 min read

ChatGPT can function as a practical programming copilot: it can generate working code from plain-English prompts, improve existing code, and...

Using ChatGPT for ProgrammingPython Code GenerationPassword Hashing

Python Pandas Tutorial (Part 6): Add/Remove Rows and Columns From DataFrames

Corey Schafer · 2 min read

Adding and removing data in pandas DataFrames comes down to a few core operations: assigning new columns from computed Series, using drop to delete...

Pandas DataFramesAdd ColumnsRemove Columns

Programming Terms: First-Class Functions

Corey Schafer · 2 min read

First-class functions let programmers treat functions like ordinary values—assigning them to variables, passing them into other functions, and...

First-Class FunctionsHigher-Order FunctionsMap Transformation

5 Common Python Mistakes and How to Fix Them

Corey Schafer · 3 min read

Python’s most common “mystery errors” often come down to a handful of avoidable habits: inconsistent indentation, naming conflicts, mutable defaults,...

Indentation ErrorsImport ShadowingMutable Default Arguments

Customizing Your Terminal: .bash_profile and .bashrc files

Corey Schafer · 2 min read

Custom terminal settings only “stick” when they’re placed in the right startup files—specifically the dotfiles in a user’s home directory:...

Bash Startup Files.bash_profile vs .bashrcTerminal Prompt Customization

Python Tutorial: pip - An in-depth look at the package management system

Corey Schafer · 2 min read

pip is the go-to command-line tool for installing, removing, and tracking Python packages, and the fastest way to get productive is to start with its...

Pip HelpPackage InstallVersion Outdated

Python Tutorial: Pipenv - Easily Manage Packages and Virtual Environments

Corey Schafer · 3 min read

pipenv is positioned as a single, Python-ecosystem tool that unifies package management and virtual environments—reducing the friction of setting up...

PipenvVirtual EnvironmentsDependency Locking

Python Pandas Tutorial (Part 9): Cleaning Data - Casting Datatypes and Handling Missing Values

Corey Schafer · 3 min read

Cleaning data in pandas often starts with two practical tasks: removing or retaining rows/columns with missing values, and converting columns into...

Missing Valuesdropnafillna

Python Tutorial: UV - A Faster, All-in-One Package Manager to Replace Pip and Venv

Corey Schafer · 3 min read

UV is positioned as a single, faster replacement for several core Python workflow tools—installing packages, creating and managing virtual...

UV Package ManagerVirtual EnvironmentsDependency Lockfiles

Python Tutorial: Itertools Module - Iterator Functions for Efficient Looping

Corey Schafer · 3 min read

Itertools is a set of Python standard-library tools built for working with iterators—sequential data you can consume one item at a time without...

Itertools ModuleInfinite IteratorsCombinatorics

Python Quick Tip: F-Strings - How to Use Them and Advanced String Formatting

Corey Schafer · 2 min read

F-strings have become the go-to way to format strings in Python 3.6+ because they make interpolation more readable and more powerful than older...

F-StringsString FormattingDictionary Interpolation

Git Tutorial: Using the Stash Command

Corey Schafer · 2 min read

Git stash is the safety net for uncommitted work: it temporarily saves local changes so developers can switch branches, inspect other code, or back...

Git StashBranch SwitchingUncommitted Changes

Homebrew Tutorial: Simplify Software Installation on Mac Using This Package Manager

Corey Schafer · 3 min read

Homebrew turns macOS software installation into a fast, command-line workflow—installing both developer tools and full macOS apps with consistent...

Homebrew InstallationPackage SearchFormulas vs Casks

Python Tutorial: Context Managers - Efficiently Managing Resources

Corey Schafer · 2 min read

Context managers in Python make resource handling reliable by guaranteeing setup and teardown happen automatically—even when errors occur. Instead of...

Context ManagersPythonResource Cleanup

Python Pandas Tutorial (Part 11): Reading/Writing Data to Different Sources - Excel, JSON, SQL, Etc

Corey Schafer · 2 min read

Pandas can move data between common formats—CSV, tab-delimited text, Excel, JSON, and SQL databases—using a small set of consistent read/write...

Reading CSVWriting ExcelJSON Orientation

Understanding Binary, Hexadecimal, Decimal (Base-10), and more

Corey Schafer · 2 min read

Binary and hexadecimal become much easier once they’re treated as “base systems” built on the same positional idea as everyday base-10 numbers. In...

Positional Number SystemsBinary ConversionHexadecimal Digits

Matplotlib Tutorial (Part 8): Plotting Time Series Data

Corey Schafer · 2 min read

Time-series plotting in Matplotlib hinges on treating dates as real datetime objects—not plain strings—and then using Matplotlib’s date formatting...

Time Series PlottingDate FormattingMatplotlib Plot Date

Python Flask Tutorial: Full-Featured Web App Part 11 - Blueprints and Configuration

Corey Schafer · 2 min read

Core finding: splitting a growing Flask app into Blueprints and moving configuration into a dedicated config object enables a more modular...

Flask BlueprintsBlueprint RoutingFlask Configuration

Python Tutorial: How to Set the Path and Switch Between Different Versions/Executables (Mac & Linux)

Corey Schafer · 3 min read

Python version mix-ups on Mac and Linux usually come down to one thing: the command line is pointing at the wrong Python executable. When “python”...

Python PATHSwitching Python VersionsBash Profile

Python Quick Tip: Hiding Passwords and Secret Keys in Environment Variables (Windows)

Corey Schafer · 2 min read

Hardcoding passwords and secret API keys directly in Python code is a common beginner mistake—and it becomes dangerous fast when code is shared with...

Environment VariablesPython SecurityWindows Setup

Python Flask Tutorial: Full-Featured Web App Part 9 - Pagination

Corey Schafer · 2 min read

Pagination becomes the centerpiece of the app’s next upgrade: instead of loading every post at once, the home feed switches to Flask-SQLAlchemy’s...

PaginationFlask-SQLAlchemyTemplate Iteration

Python Quick Tip: Hiding Passwords and Secret Keys in Environment Variables (Mac & Linux)

Corey Schafer · 2 min read

Hard-coding passwords and API keys directly in Python scripts is a common beginner mistake—especially when code is shared with a team or pushed to a...

Environment VariablesPython OS ModuleSecret Management

Python Tutorial: Write a Script to Monitor a Website, Send Alert Emails, and Reboot Servers

Corey Schafer · 2 min read

A practical Python watchdog can keep a personal website online by checking for failures, emailing an alert, and automatically rebooting the hosting...

Website MonitoringPython ScriptingSMTP Email Alerts

Python Tutorial: Sets - Set Methods and Operations to Solve Common Problems

Corey Schafer · 2 min read

Python sets are a fast, built-in way to work with collections where duplicates don’t matter—especially when the task involves comparing values across...

Python SetsSet MethodsSet Operations

Python Tkinter Tutorial (Part 1): Getting Started, Elements, Layouts, and Events

Corey Schafer · 3 min read

Tkinter’s core workflow—create a root window, add widgets, lay them out with a geometry manager, and wire user actions through callbacks and event...

Tkinter SetupGrid LayoutEvent Handling

Python Tutorial: Duck Typing and Asking Forgiveness, Not Permission (EAFP)

Corey Schafer · 2 min read

Pythonic code in this lesson comes down to two closely linked habits: treat objects by what they can do (duck typing) and prefer “try it and handle...

Duck TypingEAFPPythonic Style

Python Tutorial: str() vs repr()

Corey Schafer · 2 min read

Python’s `repr()` and `str()` both turn values into text, but they optimize for different goals: `str()` aims for readability, while `repr()` aims...

str vs reprPython String ConversionDebugging Output

Python Tutorial: Zip Files - Creating and Extracting Zip Archives

Corey Schafer · 2 min read

Python can create, compress, and extract ZIP archives using the standard library’s `zipfile` module, and it can also handle archive workflows...

Zipfile ModuleArchive CompressionContext Managers