Python - Check if the last characters in a string are numbers
Basically I want to know how I would do this. Here's an example string: string = "hello123" I would like to know how I would check if the string ends in a number, then print the number the string ends in. I know for this certain string you could use regex to determine if it ends with a number then use string[:] to select "123". BUT if I am looping through a file with strings like this: hello123 hello12324 hello12435436346 ...Then I will be unable to select the number using string[:] due to differentiation in the number lengths. I hope I explained what I need clearly enough for you guys to help