(New to Python after years of R use)
Say I have a string:
dna = "gctacccgtaatacgtttttttttt"
And I want to pre-define the indices of interest:
window_1 = 0:3
window_2 = 1:4
window_3 = 2:5
This is invalid python syntax. So I tried:
window_1 = range(0, 3)
This does not work when I try to use the window_1
variable as a string index:
dna[window_1]
But I get "string indices must be integers"
error.
I have tried numerous things such as wrapping range()
in int()
and / or list()
but nothing works.
Thanks