How to get a slice of a string with offset and length in Python

1 Answer

0 votes
s = "python java c++"

offset = 2
length = 4
slice_of_s = s[offset:offset+length]

print(slice_of_s)


'''
run:

thon

'''

 



answered Sep 17, 2018 by avibootz

Related questions

1 answer 258 views
258 views asked Nov 4, 2020 by avibootz
1 answer 307 views
1 answer 193 views
2 answers 295 views
1 answer 277 views
...