1

I have a set of strings of variable length. They all have identical characters at the start and different characters at the end.

a1="I went to the shop"
a2="I went to the wishing well"

I want to access the varying characters at the end. The most intuitive way of doing this is

a1[14:-1]

which gives the string "sho".

I could get the whole word by doing

a1[14:len(a1)]

however this doesn't feel very pythonic.

What is the pythonic way of doing this?

flaxel
  • 3,429
  • 4
  • 13
  • 26
Abijah
  • 471
  • 2
  • 12

0 Answers0