Answers for "python first instance of character in string"

10

python get first character of string

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

python search first occurrence in string

s = "the dude is a cool dude"
s.find('dude') # returns 4 - the first index of the first match in the string
Posted by: Guest on August-21-2020

Code answers related to "python first instance of character in string"

Python Answers by Framework

Browse Popular Code Answers by Language