I’m not sure what you’re looking for, do you mean find()
?
>>> x = "Hello World"
>>> x.find('World')
6
>>> x.find('Aloha');
-1
More Related Contents:
- How can I check if character in a string is a letter? (Python)
- Finding the position of a word in a string
- Format timedelta to string
- Pandas filtering for multiple substrings in series
- How to get a string after a specific substring?
- Print string to text file
- How can I do multiple substitutions using regex?
- How do I format a string using a dictionary in python-3.x?
- How to find char in string and get all the indexes?
- How to split strings into text and number?
- ValueError: could not convert string to float: id
- String to Dictionary in Python [duplicate]
- Extract email sub-strings from large document
- Find index of last occurrence of a substring in a string
- How do I convert a list into a string with spaces in Python?
- Strip spaces/tabs/newlines – python
- Python code to remove HTML tags from a string [duplicate]
- How to print like printf in Python3?
- Why are Python strings immutable? Best practices for using them
- Finding the indices of matching elements in list in Python
- Replacing specific words in a string (Python)
- Python: How to check a string for substrings from a list? [duplicate]
- Is there a way to split a string by every nth separator in Python?
- Python Remove Comma In Dollar Amount
- How to explain the reverse of a sequence by slice notation a[::-1]
- How do I escape curly-brace ({}) characters in a string while using .format (or an f-string)?
- What is internal representation of string in Python 3.x
- What does backward-slash b do in Python?
- Sort strings by the first N characters
- How to pad a string to a fixed length with spaces [duplicate]