Python Forum
Beginner. Help needed in sorting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner. Help needed in sorting
#1
Hi,

I'm new to this forum. I need help in below code.

>>> import keyword
>>> print(keyword.kwlist)
Output:
Output:
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
I try to sort the output in alphabetical order using the below code
import keyword
a = keyword.kwlist
print(a.sort())
I'm getting output as None. Could anyone help me sorting out this problem. Thanks in advance. Looking forward.
Reply


Messages In This Thread
Beginner. Help needed in sorting - by sundaeli - Mar-21-2020, 06:43 PM
RE: Beginner. Help needed in sorting - by buran - Mar-21-2020, 06:48 PM
RE: Beginner. Help needed in sorting - by sundaeli - Mar-21-2020, 07:03 PM
RE: Beginner. Help needed in sorting - by buran - Mar-21-2020, 07:11 PM
RE: Beginner. Help needed in sorting - by sundaeli - Mar-21-2020, 07:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help with sorting lists as a beginner Realist1c 1 1,440 Apr-25-2023, 04:32 AM
Last Post: deanhystad
  Sorting a copied list is also sorting the original list ? SN_YAZER 3 5,591 Apr-11-2019, 05:10 PM
Last Post: SN_YAZER

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020