How do you sort files numerically?

前端 未结 6 1232
一生所求
一生所求 2020-11-28 07:01

First off, I\'m posting this because when I was looking for a solution to the problem below, I could not find one on stackoverflow. So, I\'m hoping to add a little bit to t

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 07:31

    Partition results in Tuple

    def getint(name):
        (basename, part, ext) = name.partition('.')
        (alpha, num) = basename.split('_')
        return int(num)
    

提交回复
热议问题