Thread: Python string find() examples

  1. #1
    Banned
    Join Date
    Oct 2022
    Posts
    7

    Python string find() examples

    I'm looking for examples, but I'm not finding any.
    Are there any examples on the internet? I'd like to know what it returns when it can't find something, as well as how to specify the starting and ending points, which I assume will be 0, -1.
    Code:
    >>> x = "Hello World"
    >>> x.find('World')
    6
    >>> x.find('Aloha');
    -1
    Could you please help me? But I'm not convinced.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    You seem lost, perhaps you need to find a Python forum.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 02-09-2022, 11:09 PM
  2. Replies: 3
    Last Post: 11-24-2012, 12:31 AM
  3. Find index of last char in search string in string?
    By Programmer_P in forum C++ Programming
    Replies: 6
    Last Post: 06-07-2010, 06:51 PM
  4. Python: String to Int conversion?
    By Aran in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 05-05-2006, 10:06 PM
  5. Looking for examples for string related programs
    By koloth in forum C Programming
    Replies: 5
    Last Post: 04-14-2003, 11:57 PM

Tags for this Thread