python的哪个对象能像数据库表一样存取

Python013

python的哪个对象能像数据库表一样存取,第1张

python的ORM能像数据库表一样存取。

ORM作为数据库表记录和python中对象的映射关系中间件在python代码中通过操作orm来进行数据库的存取操作。

Python是一门开源免费、通用型的脚本编程语言,它上手简单,功能强大,坚持极简主义。

使用 if ... else ...表达式

input_id = request.POST.get('post_id')

input_pid = request.POST.get('post_pid')

where id like "\%%s" and pid like "\%%s”%(input_id if input_id else "",input_pid if input_pid else '')