# update: 2022-6-17 def get_last(data_list, amount): """获取尾部元素""" return data_list[-amount:] def cut_last(data_list, amount): """去掉尾部元素""" return data_list[:-amount] def get_head(data_list, amount): """获取头部元素""" return data_list[:amount] def cut_head(data_list, amount): """去掉头部元素""" return data_list[amount:] def reverse(string_or_list): """倒序""" if type(string_or_list) not in [str, list]: return '' return string_or_list[::-1]