-2

I wanna check a specific position in my string if it a character or not using isalpha the same by isdigit

I tried Using startswith and endswith but it didn’t work because I need to check only the start and the end of the string

  • Do you know how to select a specific character, such as `your_string[i]`? – Joe Aug 24 '23 at 10:29
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 24 '23 at 12:24

1 Answers1

0

You can select the i-th character of your string like this: ith_character = string[i] (starting with zero, of course). So, for example, if you'd like to check whether the third character is a digit, you'd write: string[2].isdigit()

Spunnring
  • 24
  • 3