Answers for "python string first index of"

12

python get first character of string

string = 'This is a string'
print(string[0])
#output: 'T'
Posted by: Guest on April-18-2020
0

how to get the index of the first integer in a string python

>>> import re
>>> s1 = "thishasadigit4here"
>>> m = re.search(r"d", s1)
>>> if m:
...     print("Digit found at position", m.start())
... else:
...     print("No digit in that string")
... 
Digit found at position 13
Posted by: Guest on October-27-2021

Code answers related to "python string first index of"

Python Answers by Framework

Browse Popular Code Answers by Language