s=list(range(20)) def get_first_m_and_last_m(s,m): # 注:如果使用s[:m-1],s[-m:-1],就会出错,特此记录 return s[:m],s[-m:] get_first_m_and_last_m(s,3)
([0, 1, 2], [17, 18, 19])
s=list(range(20)) def get_first_m_and_last_m(s,m): # 注:如果使用s[:m-1],s[-m:-1],就会出错,特此记录 return s[:m],s[-m:] get_first_m_and_last_m(s,3)
([0, 1, 2], [17, 18, 19])