← Dictionary
Code·basic

String

Text data. Anything between quotes.

A string is text. In Python, anything inside single or double quotes is a string:

name = "Stella"
greeting = 'Hello, world'
number_as_text = "42"

That last one matters: "42" is a string, 42 is a number. You can't add "42" + 1 — the types don't match.

Strings have dozens of built-in operations: joining, splitting, upper-casing, replacing, checking if one contains another. You'll use them constantly.

Related