Skip to content

How to find the location of a character in a string in Python?

>>> myString = 'Position of a character'
>>> myString.find('s')
2
>>> myString.find('x')
-1
See also  How to import discord in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.