Strings can use single or double quotes

"Hello world"

'Hello world'
Join strings
my_string = "Hello" + " World"

Multiline strings

Use triple single quotes or double quotes to start and end a multiline string.

Line breaks will occur for the linebreaks in the string you enter.

my_string_a = """ Line 1
Line 2
Line 3"""

my_string_b  = ''' Line 1
Line 2
Line 3'''

my_string_a = \
""" Line 1
Line 2
Line 3"""

Joining strings

Use the period character ‘+’

You can also use +=

    my_string = "Some" + " text";
    my_string += "Some more text";


  length = len(my_string);
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.


Your email address will not be published. Required fields are marked *