Operators, Delimiters, and Special Symbols

The following operators are recognized:

+    -    *    **    /    //    %    <<    >>   &    |
^    ~    <     >    <=   >=    ==   !=    <>   +=
-=   *=   /=   //=   %=   **=   &=   |=    ^=   >>=  <<=

The following tokens serve as delimiters for expressions, lists, dictionaries, and various parts of a statement:

(    )    [    ]    {    }   ,    :    .    `    =    ;

For example, the equal (=) character serves as a delimiter between the name and value of an assignment, whereas the comma (,) character is used to delimit arguments to a function, elements in lists and tuples, and so on. The period (.) is also used in floating-point numbers and in the ellipsis (...) used in extended slicing operations.

Finally, the following special symbols are also used:

'     "     #     \    @

The characters $ and ? have no meaning ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.