I have a python f-string as follows:
def send_string():
ticket_id=123
message = f'{ticket_id} Jira created successfully'
return message
def extract_ticket_from_message(message):
#pseudo code
# Is it possible to extract the ticket id without parsing the
# whole string and using regex
Is there a convenient way of extracting the ticket_id value from the f-string without having to parse the whole string using regex in Python 3.6?
ticket_idshould hold it. I'm guessing that's not what you're looking for... can you expand a bit? Maybe with a little more example code?message.split(maxsplit=1)[0]?yourDesiredResult = str(ticket_id)? Is this an XY problem?yourDesiredResult = ticket_id?