A Byte of Python

Strings

A string is a sequence of characters. In other words, a string is basically a bunch of words and/or symbols.

You will use strings in almost every program that you will write, hence it is very important to understand strings properly.

We will now learn the various ways of using strings in Python:

Note for C/C++ Programmers

There is no separate char datatype in Python. There is no real need for it and I'm sure you won't miss it.

Note for Perl/PHP Programmers

Remember that single-quoted strings and double-quoted strings are the same, they do not differ in any way.

Note for Regular Expression Users

Always use raw strings when dealing with regular expressions, otherwise, a lot of backwhacking may be required. For example, backreferences can be referred as '\\1' or as r'\1'.