$ pythonPython 2.7.3 (default, Jan2 2013, 16:53:07) [GCC 4.7.2] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> D=[1,2,3,4,5,'a','b','c']>>> index=5>>> def shift(lst, idx):...
return lst[idx+1:]+[lst[idx],]+lst[:idx]... >>> shift(D,index)['b', 'c', 'a', 1, 2, 3, 4, 5]>>>...
|