How to get char from string by index?

后端 未结 7 1035
青春惊慌失措
青春惊慌失措 2020-11-29 04:25

Lets say I have a string that consists of x unknown chars. How could I get char nr. 13 or char nr. x-14?

7条回答
  •  情深已故
    2020-11-29 04:46

    Another recommended exersice for understanding lists and indexes:

    L = ['a', 'b', 'c']
    for index, item in enumerate(L):
        print index + '\n' + item
    
    0
    a
    1
    b
    2
    c 
    

提交回复
热议问题