loading

摘要: sql 插入的值肯定是动态的,通过 `%s` 占位符插入变量: ```py def insert_cover(data: pojos.Cover): sql = "insert into covers (temp, accel_x, accel_y, accel_z, cover_status,da 阅读全文
posted @ 2023-06-22 22:20 Himmelbleu 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 在 json 字符串中,对某个 key 插入一个变量值而非固定的值可以照以下的例子来实现: ```py beep_status = "ON" f"{{\"Beep\":\"{beep_status}\"}}" ``` 在 json 字符串外套一层 `{}` 和 f,在取变量时通过 `{beep_st 阅读全文
posted @ 2023-06-22 22:15 Himmelbleu 阅读(8) 评论(0) 推荐(0) 编辑