Solving Q2

Notes:

About venv

  1. After

    actually a folder named venv is created in the current directory, enter

  2. to enter the virtual environment stored in that folder. Anythings done in Step 2 after that venv will only effective inside that venv

About sqlite

  1.  After

    actually a db named charger is created in the current directory, You can rename it to charger.db without problems.
  2. .databases can show the databases names in the .db
  3. .tables can show the tables in the db
  4. to import .csv, you need to change to .mode csv inside sqlite before import csv file

About cursor.fetchall(),

  1. It return a list of tuple. Although the each tuple has only one instance, you still need to claim the instance by using e.g. tuple[0], otherwise, a sequence is passed into the query. That maybe invalid .

code:

 

Leave a Reply