开发者社区> 问答> 正文

把sql语句转化成python代码

把sql语句转化成python代码

展开
收起
珍宝珠 2019-11-20 14:21:50 4387 0
3 条回答
写回答
取消 提交回答
  • 是不是这个意思:

    if __name__ == '__main__':
        company = [{'title': 'ssabcdd', 'mecount': 123, 'createtime': '2020-12-01'},
                   {'title': 'ssabcdd', 'mecount': 1000, 'createtime': '2020-02-01'}]
        result = []
        for row in company:
            if row['title'].__contains__('abc') or row['mecount'] > 999:
                result.append(row)
        result.sort(key=lambda x: x['createtime'])
        print(result)
    
    2020-02-08 16:25:57
    赞同 展开评论 打赏
  • 什么意思,没有懂,是说用python执行sql语句?

    2019-11-21 16:54:43
    赞同 展开评论 打赏
  • select * from company where title like "%abc%" or mecount>999 order by createtime desc;
    
    2019-11-20 14:22:01
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
SQL Server 2017 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载