Page 210 -
P. 210

hashes and databases


                              Your Programming Toolbox


                               You’ve got Chapter 5 under your belt.
                                Let’s look back at what you’ve learned
                                in this chapter:                                                                CHAPTER 5





                Programming T ools

                * hash - a data structure that
                 associates a name with a value

                 * s[‘age'] - retrieve the value
                  associated with the ‘age' name in a


                  hash called ‘s'
                  * returning a data structure from a

                   function                            Python T ools
                   * database system - a technology,   * {} - an empty hash
                    like SQLite3, that can store large
                     quantities of data in a very efficient


                     way                              * s[‘wind'] = “off shore" - sets that value
                                                      associated with “wind” in the “s” hash to the
                                                      value “off shore”

                                                     * s.keys() - provide a list of keys for the
                                                     hash called ‘s'


                                                     * s.items() - provide a list of keys AND values
                                                     for the hash called ‘s'

                                                     * line.split(“,") - split the string contained
                                                     within the ‘line' variable at every occurrence of
                                                     a comma

                                                    * sorted() - a built-in function that can sort
                                                    most data structures









                                                                                       you are here 4    175
   205   206   207   208   209   210   211   212   213   214   215