Answers for "string array sorting in python"

1

how to sort a string list in python

fruits_list = ["orange", "mango", "kiwi", "pineapple", "banana"]
fruits_list.sort()
print(fruits_list)
Posted by: Guest on October-16-2021
0

sort a string in python

#Sorted function returns the string as a list which we are converting to a string again using join
new_str=''.join(sorted(old_str))
Posted by: Guest on July-21-2021

Python Answers by Framework

Browse Popular Code Answers by Language