For example,
str = "hello"
str[1::3]
And where can I find this in Python documentation?
For example,
str = "hello"
str[1::3]
And where can I find this in Python documentation?
 
    
     
    
    s[i:j:k]    slice of s from i to j with step k
The slice of
sfromitojwith stepkis defined as the sequence of items with indexx = i + n*ksuch that0 <= n < (j-i)/k. In other words, the indices arei,i+k,i+2*k,i+3*kand so on, stopping whenjis reached (but never includingj). Ifiorjis greater thanlen(s), uselen(s). Ifiorjare omitted orNone, they become “end” values (which end depends on the sign ofk). Note,kcannot be zero. IfkisNone, it is treated like 1.
