Answer the question
In order to leave comments, you need to log in
How to cut in a string from the desired character to the next LETTER?
For example, there is a string: "F34E72H7" .
I need to cut from the letter E to H, and select the number 72. Of course, it could have been done like this:
my = "F34E72H7"
print (my[my.index("E"):my[my.index("H")]) #72
Answer the question
In order to leave comments, you need to log in
my = "G5293S982J"
start = input('Enter the start: ').upper() # S
end = input('Enter the end: ').upper() # J
try:
result = my[(my.index(start)+1):my.index(end)]
print(result) # 982
except:
print('No matches!')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question