Page 53 - Programming the Raspberry Pi Getting Started with Python
P. 53

We  cover  exceptions  again  in  the  next  chapter,  where  you  will  learn  about  the  hierarchy  of  the
          different types of error that can be caught.

          Summary of Functions
          This chapter was written to get you up to speed with the most important features of Python as quickly
          as possible. By necessity, we have glossed over a few things and left a few things out. Therefore, this
          section provides a reference of some of the key features and functions available for the main types we
          have  discussed. Treat it as a resource you can refer back to as you progress though the book, and be
          sure to try out some of the functions to see how they work. There is no need to go through everything
          in this section—just know that it is here when you need it. Remember, the Python Shell is your friend.
             For full details of everything in Python, refer to http://docs.python.org/py3k.

          Numbers
          Table 4-1 shows some of the functions you can use with numbers.









































          Table 4-1   Number Functions
          Strings
          String  constants  can  be  enclosed  either  with  single  quotes  (most  common)  or  with  double  quotes.

          Double quotes are useful if you want to include single quotes in the string, like this:

             On some occasions you’ll want to include special characters such as end-of-lines and tabs into a
          string. To  do  this,  you  use  what  are  called escape  characters,  which  begin  with  a  backslash  (\)
          character. Here are the only ones you are likely to need:
             •  \t Tab character
             •  \n Newline character
   48   49   50   51   52   53   54   55   56   57   58