You can download this code by clicking the button below.
This code is now available for download.
This function takes a list of words and returns a new list with the words sorted by length.
Technology Stack : re, time, math, random, sys, os
Code Type : Function
Code Difficulty : Intermediate
import re
import time
import math
import random
import sys
import os
def sort_words_by_length(words):
"""对单词列表按长度排序
Args:
words (list): 单词列表
Returns:
list: 排序后的单词列表
"""
return sorted(words, key=len)