Can you sort a string in python?



Can you sort a string in python?..

Answer / Mithun Singh Rana

Yes, you can sort a string in Python using the `sorted()` function. However, by default, it sorts the elements as if they were a list of characters (ignoring their actual alphabetical order). To sort a string according to its actual alphabetical or lexicographical order, you can convert it into a list of characters and then sort it.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Can we use angularjs with python?

1 Answers  


In python, how do I check if a list is empty?

1 Answers  


What is the difference between the shallow copy and deep copy in python?

1 Answers  


What is the difference between a tuple and a list?

1 Answers  


What are the 3 types of relation?

1 Answers  


Tell me what are different methods to copy an object in python?

0 Answers  


What are python templates?

1 Answers  


What does append () do in python?

1 Answers  


What is the mro in python?

1 Answers  


Why do we need Python Directories

1 Answers  


What is a means by “tuple in python”?

1 Answers  


How install pip python ubuntu?

1 Answers  


Categories