t.py 551 B

12345678910111213141516171819202122232425
  1. import Stateful
  2. def MatchTomlTable(tomlName, tableName, returnType="list"):
  3. d = Stateful.GetTomlDoc(tomlName).unwrap()
  4. if returnType == "list":
  5. return list(d.get(tableName).values())
  6. elif returnType == "dict":
  7. return d
  8. def add():
  9. values = []
  10. sqls = "INSERT INTO {table} VALUES({values})".format(table=self.table, values=values)
  11. res = Stateful.Exec_one(dp, sqls)
  12. if __name__ == "__main__":
  13. tomlName = "dev_config.toml"
  14. dp = "dev.db"
  15. res = MatchTomlTable(tomlName, "Board")
  16. print(res)