We started off by treating the Python interpreter as a calculator, and we took a good look at how numbers are defined and manipulated in the language. Now we'll move on to some more complicated values by investigating how Python deals with strings. A string is a collection of characters, such as a word, a sentence, or a proper name. It might be a date, or it might even be a number. The crucial difference is that the data is treated as a piece of text. In this chapter, you'll see how strings are defined and used in Python, and you'll discover the new ways you can use these data values.
Text, the Python way
A string is Python's data type for storing a piece of text.
>>> "Hello World"
'Hello World'
Strings can be enclosed in single quotes, double quotes, or even triple quotes, depending on the way you like to input your variables. They all have slightly different formatting, and it is probably best to treat each case by example. If you've stored some characters in between quotes, you've got a variable that Python understands to be a string type.