啥也不是,菜的一批
change_str = '123456' def temp(a, b): a, b = b, a return a, b def change(change_str: str = change_str) -> str: change_list = list(change_str) result_list = [] j = 0 for i in range(0, len(change_list) - 1): j += 1 if j % 2 != 0: c = temp(change_list[i], change_list[i + 1]) result_list += list(c) print(''.join(result_list)) change() # 结果 214365