June 2025
Beginner to intermediate
473 pages
13h 30m
English
In Python, strings can be optionally placed in single or double quotation marks. Both spellings are equivalent and differ only in that the other quotation marks can be integrated into the character string in an uncomplicated way. Three strings are defined in the following example, stored in the s, t, and u variables:
>>> s = 'Python is fun!'>>> t = "Rheinwerk">>> u = '<img src="https://xxx">'
Regardless of the quotation mark type, quotation marks with \' or \" can be included in the string. Other \ character combinations, referred to as escape sequences, exist in Python. In Python’s interactive application, strings containing such special characters behave differently depending on whether they are output directly or via print ...
Read now
Unlock full access