IT 117: Intermediate Scripting
Quiz 6 Answers

  1. Write the regular expression that is equivalent to * on the Unix command line.
    .*
  2. Write a regular expression that will match one or more whitespace characters.
    \s+
  3. Write a regular expression that can be used to find all lines in a file that contain "GET" somewhere in the line.
    .*GET
  4. Write a regular expression that will match one of the octets in an IPv4 address.
    \d{1,3}
  5. Write a regular expression that will match an IPv4 address.
    \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
  6. What is the name of the module that allows Python to work with a SQLite database?
    sqlite3
  7. What would you enter at the command line if you wanted a SQLite command line that let you work with the database contained in the file work.db?
    sqlite3 work.db
  8. If you were writing a Python script that needed to work with a SQLite database what is the first thing you would have to create?
    a connection object to the database
  9. Write the Python statement that would create the thing mentioned above on the SQLite file work.db.
    con = sqlite3.connect("work.db")
  10. Once you have the thing mentioned above, what is the next thing you have to create?
    a cursor object