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 254 views
254 views asked Nov 4, 2020 by avibootz
1 answer 303 views
1 answer 187 views
2 answers 290 views
1 answer 270 views
...