RC wrote: > unsortedList = list(["XYZ","ABC"]) > > sortedList = unsortedList.sort() > print sortedList > > > Why this return None? > How do I get return as ["ABC", "XYZ"]?
The list's .sort method returns None because it modifies the list in-place, so after the call it is sorted. So you can either not assign the list and use unsortedList (whose name now belies its sorted condition) or you can use sprtedList = sorted(unsortedList) since the sorted() function returns a sorted copy of its argument. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list