Python endwith的等价表达式子 [::-1][0:len(ns)][::-1] 先倒序再截取,再倒序

    # n2s.endswith(ns)
    # n2s[::-1][0:len(ns)][::-1] == ns

Python  endwith的等价表达式子

posted @ 2022-07-30 15:16  bH1pJ  阅读(15)  评论(0编辑  收藏  举报