O'Reilly logo

The Python Quick Syntax Reference by Gregory Walters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 4

image

Strings

String objects exist in practically every programming language. A string is simply a series of characters assigned to a variable. Python strings are immutable, which means that once created, they can not be changed. String assignments look like this:

s = 'Abcdefg'

Appending to Srings

Although Python strings are immutable, we can perform many operations on them, including appending other information to the string.>>> a = "This is a test"

>>> a = a + " of strings">>> a'This is a test of strings'

In this case, a copy of the string is made, the second string is appended to the copy, then the original is deleted and the new string ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required