I/O Operations and String Formatting

Learning PathSkills: Python, Fundamentals, I/O, String Formatting

A person presenting a machine that can perform modern Python string interpolation and formatting

Master Python’s input, output, and string formatting with our comprehensive path. Learn keyboard input, integer handling, and advanced print techniques. Dive into modern string formatting with f-strings and the format mini-language. Perfect for enhancing your Python coding skills!

I/O Operations and String Formatting

Learning Path ⋅ 8 Resources

Title image for Reading Input and Writing Output in Python (Basic Input, Output, and String Formatting in Python)

Course

Reading Input and Writing Output in Python

In this introductory Python course, you'll learn how to take user input from the keyboard with the built-in function input() and how to display output to the console with the built-in function print().

Title image for How to Read User Input From the Keyboard in Python (How to Read User Input From the Keyboard in Python)

Tutorial

How to Read User Input From the Keyboard in Python

Reading user input from the keyboard is a valuable skill for a Python programmer, and you can create interactive and advanced programs that run on the terminal. In this tutorial, you'll learn how to create robust user input programs, integrating error handling and multiple entries.

Title image for How to Read Python Input as Integers (How to Read Python Input as Integers)

Tutorial

How to Read Python Input as Integers

Learn how to use Python to get integer input from the user while handling any errors resulting from non-numeric input. This will involve coding your own reusable function built around input().

Title image for The Python print() Function: Go Beyond the Basics (The Ultimate Guide to Python Print)

Course

The Python print() Function: Go Beyond the Basics

Learn about the print() function in Python and discover some of its lesser-known features. Avoid common mistakes, take your "hello world" to the next level, and know when to use a better alternative.

Title image for The Python print() Function (The Ultimate Guide to Python Print)

Interactive Quiz

The Python print() Function

Title image for Formatting Python Strings (A Guide to the Newer Python String Format Techniques)

Course

Formatting Python Strings

See two items to add to your Python string formatting toolkit. You'll learn about Python's string format method and the formatted string literal, or f-string. You'll learn about these formatting techniques in detail and add them to your Python string formatting toolkit.

Title image for Python 3's F-Strings: An Improved String Formatting Syntax (F-Strings in Python 3.6)

Course

Python 3's F-Strings: An Improved String Formatting Syntax

As of Python 3.6, f-strings are a great new way to format strings. Not only are they more readable, more concise, and less prone to error than other ways of formatting, but they are also faster! By the end of this course, you'll know how and why to start using f-strings today.

Title image for Python F-Strings (F-Strings in Python 3.6)

Interactive Quiz

Python F-Strings

Title image for Formatting Floats Inside Python F-Strings (How to Format Floats Within F-Strings in Python)

Course

Formatting Floats Inside Python F-Strings

Learn how to use Python format specifiers within an f-string to allow you to neatly format a float to your required precision.

Title image for Python's Format Mini-Language for Tidy Strings (Python's Format Mini-Language for Tidy Strings)

Tutorial

Python's Format Mini-Language for Tidy Strings

Learn about Python's format mini-language. You'll learn how to use the mini-language to create working format specifiers and build nicely formatted strings and messages in your code.

Got feedback on this learning path?

Looking for real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

« Browse All Learning Paths