Real Python
  • Start Here
  • Learn Python
    Python Tutorials →
    In-depth articles and video courses
    Learning Paths →
    Guided study plans for accelerated learning
    Quizzes & Exercises →
    Check your learning progress
    Browse Topics →
    Focus on a specific area or skill level
    Community Chat →
    Learn with other Pythonistas
    Office Hours →
    Live Q&A calls with Python experts
    Podcast →
    Hear what’s new in the world of Python
    Books →
    Round out your knowledge and learn offline
    Reference →
    Concise definitions for common Python terms
    Code Mentor →Beta
    Personalized code assistance & learning tools
    Unlock All Content →
  • More
    Learner Stories Python Newsletter Python Job Board Meet the Team Become a Tutorial Writer Become a Video Instructor
  • Search
/
  • Join
  • Sign‑In

— FREE Email Series —

🐍 Python Tricks 💌

Python Tricks Dictionary Merge

🔒 No spam. Unsubscribe any time.

Browse Topics Guided Learning Paths
Basics Intermediate Advanced
ai algorithms api best-practices career community databases data-science data-structures data-viz devops django docker editors flask front-end gamedev gui machine-learning news numpy projects python stdlib testing tools web-dev web-scraping

Table of Contents

  • Getting to Know Strings and Characters in Python
  • Creating Strings in Python
    • Standard String Literals
    • Escape Sequences in String Literals
    • Raw String Literals
    • Formatted String Literals
    • The Built-in str() Function
  • Using Operators on Strings
    • Concatenating Strings: The + Operator
    • Repeating Strings: The * Operator
    • Finding Substrings in a String: The in and not in Operators
  • Exploring Built-in Functions for String Processing
    • Finding the Number of Characters: len()
    • Converting Objects Into Strings: str() and repr()
    • Formatting Strings: format()
    • Processing Characters Through Code Points: ord() and chr()
  • Indexing and Slicing Strings
    • Indexing Strings
    • Slicing Strings
  • Doing String Interpolation and Formatting
    • Using F-Strings
    • Using the .format() Method
    • Using the Modulo Operator (%)
  • Exploring str Class Methods
    • Manipulating Casing
    • Finding and Replacing Substrings
    • Classifying Strings
    • Formatting Strings
    • Joining and Splitting Strings
  • Conclusion
  • Frequently Asked Questions

Recommended Course