About 476,000 results
Open links in new tab
  1. python - how to find whether a string is contained in another …

    that's it as far as all the info i have for now. however, if you are learning Python and/or learning programming, one highly useful exercise i give to my students is to try and build *find() and …

  2. string - How to get the position of a character in Python ... - Stack ...

    Feb 19, 2010 · Python has a in-built string method that does the work: index(). string.index(value, start, end) Where: Value: (Required) The value to search for. start: (Optional) Where to start …

  3. python - How to find all occurrences of a substring ... - Stack …

    Python has string.find() and string.rfind() to get the index of a substring in a string.. I'm wondering whether there is something like string.find_all() which can return all found indexes (not only the …

  4. Check if a word is in a string in Python - Stack Overflow

    I'm working with Python, and I'm trying to find out if you can tell if a word is in a string. I have found some information about identifying if the word is in the string - using .find, but is ther...

  5. Examples for string find in Python - Stack Overflow

    Jul 7, 2013 · if x is a string and you search for y which also a string their is two cases : case 1: y is exist in x so x.find(y) = the index (the position) of the y in x . case 2: y is not exist so x.find (y) = …

  6. How do I check for an exact word or phrase in a string in Python

    This checks to see if the characters in a string match at the start of another string "abcde".startswith("abc") -> true "abcde".startswith("bcd") -> false There is also the endswith() …

  7. How to extract numbers from a string in Python? - Stack Overflow

    Nov 27, 2010 · line2 = "hello 12 hi 89" # this is the given string temp1 = re.findall(r'\d+', line2) # find number of digits through regular expression res2 = list(map(int, temp1)) print(res2) you …

  8. python - Search File And Find Exact Match And Print Line ... - Stack ...

    Jan 12, 2017 · Here's the the problem I have, I'm trying to have a python script search a text file, the text file has numbers in a list and every number corresponds to a line of text and if the …

  9. python - Find string between two substrings - Stack Overflow

    Jul 30, 2010 · These solutions assume the start string and final string are different. Here is a solution I use for an entire file when the initial and final indicators are the same, assuming the …

  10. What is the difference between re.search and re.match?

    Python offers two different primitive operations based on regular expressions: match checks for a match only at the beginning of the string, while search checks for a match anywhere in the …

Refresh