[Python3] Sort the list use key
define a function to label the item in logs with 0 if the rest is alphabet, with 1 if the rest is number.\n  sort the list according to the label.\n\n#Python St
*  define a function to label the item in logs with 0 if the rest is alphabet, with 1 if the rest is number.\n*  sort the list according to the label.\n```\n#Python String | split()\nsplit() method returns a list of strings after breaking the given string by the specified separator.\nSyntax :\nstr.split(separator, maxsplit)\nword = \'I, like, algorithm, and, datastructure\'\n  \n# maxsplit: 0 \nprint(word.split(\', \', 0)) \n >>[\'I, like, algorithm, and, datastructure\'] \n\n# maxsplit: 4 \nprint(word.split(\', \', 4)) \n>>[\'I\', \'like\', \'algorithm\', \'and\', \'datastructure\']\n\n\n# maxsplit: 1 \nprint(word.split(\', \', 1)) \n>>[\'I\', \'like, algorithm, and, datastructure\']\n\n```\n```\nInput: logs = [\n\t\t\t\t"dig1 8 1 5 1",\n\t\t\t\t"let1 art can",\n\t\t\t\t"dig2 3 6",\n\t\t\t\t"let2 own kit dig",\n\t\t\t\t"let3 art zero"]\n\t\t\t\t\n# a, b = log.split(" ", 1)\n\na: a1      b:  9 2 3 1\na: g1      b:  act car\na: zo4    b:  4 7\na: ab1    b:  off key dog\na: a8      b:  act zoo\n\nOutput = [\n\t\t\t"let1 art can",\n\t\t\t"let3 art zero",\n\t\t\t"let2 own kit dig",\n\t\t\t"dig1 8 1 5 1",\n\t\t\t"dig2 3 6"]\n```\nBy default, sort(key) means to sort the list by key in increasing order.\nif b[0] is letter: key = (0,b,a)\nIf b[0] is not letter: key = (1,None,None)\n **effect of use (None,None) is when you sort letter-logs, the digit-logs remain in the same order.**\n(1,) is short for (1,None,None). \nstep 1: 0 < 1: so letter-logs come before any digit-log.\nwe get:\n["let1 art can","let2 own kit dig","let3 art zero","dig1 8 1 5 1","dig2 3 6"]\nstep 2: b and None The letter-logs are sorted lexicographically by contend(b), the digit-logs remain in the same order\nWe get:\n["let1 art can","let3 art zero","let2 own kit dig","dig1 8 1 5 1","dig2 3 6"]\nstep3: a and None, The letter-logs are sorted lexicographically by identifier(a), the digit-logs remain in the same order.\nWe get:\n["let1 art can","let3 art zero","let2 own kit dig","dig1 8 1 5 1","dig2 3 6"]\n\n```\nclass Solution:\n    def reorderLogFiles(self, logs: List[str]) -> List[str]:\n        return sorted(logs,key = self.sort)\n    def sort(self,logs):\n            a,b = logs.split(\' \', 1)\n            if b[0].isalpha():\n                return (0,b,a)\n            else:\n                return (1,None,None)\n```
['Python', 'Python3']