Coder Social home page Coder Social logo

number-sort's Introduction

字符串数组排序


简介

对一个格式相同,包含中文数字或者阿拉伯数字的字符串数组进行排序

适用范围

  • 字符串采用统一格式,有相同的前缀或者后缀
  • 包含数字部分,可以是阿拉伯数字,也可以是中文数字

代码示例

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from sortmethod import sortNames

list1 = ['框6图','框11图','框1图','框5图','框8图','框12图','框7图','框2图','框9图','框10图','框4图','框3图']
list2 = ['框六图','框一图','框九图','框七图','框十二图','框十图','框三图','框十一图','框四图','框八图','框二图','框五图']

print('list1排序后为: %s \n list2排序后为: %s' % (sortNames(list1), sortNames(list2)))

输出结果为:

list1排序后为:['框1图', '框2图', '框3图', '框4图', '框5图', '框6图', '框7图', '框8图', '框9图', '框10图', '框11图', '框12图']
list2排序后为:['框一图', '框二图', '框三图', '框四图', '框五图', '框六图', '框七图', '框八图', '框九图', '框十图', '框十一图', '框十二图']

GUI形式

制作中...

number-sort's People

Contributors

ricosmall avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.