Tutorial Series

Working with Strings in Python 3

Default avatar
By Lisa Tagliaferri
Developer and author at DigitalOcean.
Working with Strings in Python 3

Introduction

A string is a sequence of one or more characters (letters, numbers, symbols) that can be either a constant or a variable. Made up of Unicode, strings are immutable sequences, meaning they are unchanging.

Because text is such a common form of data that we use in everyday life, the string data type is a very important building block of programming.

This tutorial series will go over several of the major ways to work with and manipulate strings in Python 3.

Summary View
detailed View

Series Tutorials

Tutorial

This Python tutorial will go over the basics of working with strings, including how to create and print strings, concatenate and replicate strings, and store strings in variables.

Tutorial

How To Format Text in Python 3

Updated on August 20, 2021

In this tutorial, we’ll go over some of the ways we can work with Python strings to make sure that all output text is formatted correctly. Topics we will cover include: quotes, apostrophes, multiple lines, escape characters, and raw strings.

Tutorial

Python has several built-in functions associated with the string data type. These functions let us easily modify and manipulate strings. In this tutorial, we’ll go over several different functions that we can use to work with strings in Python 3.

Tutorial

How To Index and Slice Strings in Python 3

Updated on December 15, 2021

The Python string data type is a sequence made up of one or more individual characters consisting of letters, numbers, whitespace characters, or symbols. Strings are sequences and can be accessed in the same ways as other sequence-based data types, through indexing and slicing. This tutorial will guide you through how to access strings through indexing and how to slice them through their character sequences; it will also cover counting and character location methods.

Check out all our Tutorial Series

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.