def get_three(): lis = [] for i in range(1, 5): for j in range(1, 5): for k in range(1, 5): if i != j and j != k and k != i: res = '%s%s%s' % (i, j, k) lis.append(res) print('这个数组的长度是%s,包含的元素有%s' % (len(lis), lis))get_three()