Line conversion to sorting in lexicographic order
📁 List, string, Advanced Python Topics
How to convert a string consisting of words separated by spaces, and sort the resulting list in lexicographic order?
Given a string of words separated by spaces:
S = 'abc a bcd bc abc bc bcd abc'
We convert it by splitting on spaces:
A = S.split(' ')
We get:
['abc', 'a', 'bcd', 'bc', 'abc', 'bc', 'bcd', 'abc']