# 通过len() 来确定中间位置,这种方法更加通用。 group_list = ['Tom', 'Allen', 'Jane', 'William', 'Tony' ] length = len(group_list) group1 =group_list[:2] group2 = group_list[length//2-1:length//2+2] group3 = group_list[-2:] print(group1) print(group2) print(group3)