I have several strings in Python. Let's assume each string is associated with a variable. These strings are only composed of characters and integers:
one = '74A76B217C'
two = '8B7A1742B'
three = '8123A9A8B'
I would like a conditional in my code which checks these strings if 'A' exists first, and if so, return the integer.
So, in the example above, the first integer and first character is: for one, 74 and A; for two, 8 and B; for three, 8123 and A.
For the function, one would return True, and 74; two would be False, and three would be 8123 and A.
My problem is, I am not sure how to efficiently parse the strings in order to check for the first integer and character.
In Python, there are methods to check whether the character exists in the string, e.g.
if 'A' in one:
print('contains A')
But this doesn't take order into account order. What is the most efficient way to access the first character and first integer, or at least check whether the first character to occur in a string is of a certain identity?
five = 'A123BCD'andsix = 'A1A2A3'