Python/sage: can lists start at index 1?

后端 未结 5 1112
逝去的感伤
逝去的感伤 2021-01-04 13:25

I\'ve downloaded from a supposedly serious source a sage script. It doesn\'t work on my computer, and a quick debugging showed that a problem came from the fact that at some

5条回答
  •  感情败类
    2021-01-04 13:51

    In [1]: index_0 = ['foo', 'bar', 'quux']
    
    In [2]: index_1 = [None] + index_0
    
    In [3]: index_1[1]
    Out[3]: 'foo'
    
    In [4]: index_1[1:]
    Out[4]: ['foo', 'bar', 'quux']
    

提交回复
热议问题