1 15 def fun(arg): 2 16 if type(arg) is not tuple 3 17 and type(arg) is not str 4 18 and type(arg) is not list: 5 19 print(‘请输入一个序列‘) 6 20 return None 7 21 8 22 tmp_list = list(arg) 9 23 tmp_list.reverse() 10 24 11 25 if type(arg) == tuple: 12 26 arg = tuple(tmp_list) 13 27 elif type(arg) == str: 14 28 arg = ‘‘.join(tmp_list) 15 29 elif type(arg) == list: 16 30 arg = list(tmp_list) 17 31 18 32 19 33 return arg
时间: 2024-11-29 07:09:06