sorted(array, key=lambda x:x[:24])
Example:
>>> a = ["wxyz", "abce", "abcd", "bcde"]
>>> sorted(a)
['abcd', 'abce', 'bcde', 'wxyz']
>>> sorted(a, key=lambda x:x[:3])
['abce', 'abcd', 'bcde', 'wxyz']
More Related Contents:
- How to correctly sort a string with a number inside? [duplicate]
- How to sort a list of strings?
- case-insensitive list sorting, without lowercasing the result?
- Sort list of strings by a part of the string
- Can I sort text by its numeric value in Python?
- How to sort a list of strings in reverse order without using reverse=True parameter?
- Why is it string.join(list) instead of list.join(string)?
- How to convert string representation of list to a list?
- Comparing a string to multiple items in Python
- Join a list of items with different types as string in Python
- How to convert string to binary?
- Rank items in an array using Python/NumPy, without sorting array twice
- Split a string at uppercase letters
- python replace single backslash with double backslash
- Python float – str – float weirdness
- How do I split the definition of a long string over multiple lines?
- formatting long numbers as strings in python
- Why does my Pandas DataFrame not display new order using `sort_values`?
- Remove ‘b’ character do in front of a string literal in Python 3 [duplicate]
- Python regex: splitting on pattern match that is an empty string
- What is the simplest way to swap each pair of adjoining chars in a string with Python?
- How to explain the str.maketrans function in Python 3.6?
- Byte Array to Hex String
- Sort a list with a custom order in Python
- String-based enum in Python
- How do I format a number with a variable number of digits in Python?
- Convert True/False value read from file to boolean
- Split text after the second occurrence of character
- Find all the occurrences of a character in a string
- Mutable and Immutable Strings in python