First of all, I apologize for my vague question framing, I just couldn't figure out what to call this question. I have also searched google a lot trying to find the solution but I came to no conclusion.
I currently have a whole string with numbers like these 15-5.{123434}.15-18.
. I want to iterate over the string, and as soon as I encounter an opening curly brace I want to take all of numbers after that before encountering a closing brace and put them in a variable. I have thought of a way of doing this, like this:
string = '15-5.{123434}.15-18.'
result = ""
for index, letter in enumerate(string): # For every letter with it's index,
if letter == '{': # If letter is '{',
for number in string[index:]: # Start a loop from that index,
if number =='}': # If number becomes '}',
break
result += number #Else append the number in the result string.
However, I was wondering if there was a better way of doing this. I appreciate all of the answers. Thank you!
System: Windows 10, 32bit Python version: 3.6.0