Python strings
Python has a lot of ways to represent strings, so it is useful to be familiar with them in case you ever find them in any python program.
Ordinary Strings
These are probably the most commonly used strings on python. You can enclose them using single or double quotes (‘ or “) and you can use a backslash to escape characters or to print special characters like a line break:
1
2
3
4
5
6
7
8
9
10
print "Hello\nWorld"
Hello
World
print 'Hello\nWorld'
Hello
World
print 'This is a backslash: \\'
This is a backslash: \