Python string find() examples

Sachinbhatt

Mitglied
I'm looking for examples but am having no luck.
Is anyone aware of any examples on the internet? I'd like to know what it returns when it can't find something, and how to specify from start to end, which I assume will be 0, -1.
Python:
>>> x = "Hello World"
>>> x.find('World')
6
>>> x.find('Aloha');
-1
Could someone please assist me? But I'm not sure about it.
 

KonradN

Super-Moderator
Mitarbeiter
Are you looking for a reference? That could be found at:

So find takes the arguments:
  • String to search for
  • Optional: start
  • Optional: end
and it returns the index where the text is found or -1 if it cannot find the string you are looking for.
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
N JSON export String Unicode? XML & JSON 6
W Request als String XML & JSON 0
L Soapnachricht aus String erstellen XML & JSON 0
R String in XSLT teilen XML & JSON 3
P Bestimmte XML-Inhalte in String lesen XML & JSON 2
M RSS als String speichern XML & JSON 12
W XMLStreamReader zu String machen? XML & JSON 2
B XML-Element als String ausgeben XML & JSON 5
H XML String auslesen XML & JSON 4
H XML String erstellen XML & JSON 4
T Wie einen String(XML Inhalt) in eine XML Datei speichern? XML & JSON 8
N XML-String in MIDP auslesen XML & JSON 3
W String nach XML nach String verwandeln XML & JSON 4
W XML DomDocument als String auslesen XML & JSON 2
B jdom document aus string erzeugen? XML & JSON 1
H Adapter: String->Element bzw. Element->String XML & JSON 6
A XML Tags als PHP String XML & JSON 4
S String in element casten XML & JSON 2
I XML-String mit SAX parsen ? XML & JSON 2
S JAVA XML Parser der einen String parst XML & JSON 3
G Elementbaum in String umwandeln XML & JSON 5
A StAX API: Cannot Cast from QName to String! XML & JSON 2
S org.jdom.document in String umwandeln. XML & JSON 2
S DefaultMutableTreeNodes als String in Textdatei speichern XML & JSON 7
W Xml-String parsen XML & JSON 2
B XML String einlesen XML & JSON 4
R XML Document als String XML & JSON 2
M Probleme mit String XML & JSON 3
G getAtributeValue liefert String mit störenden Steuerzeichen XML & JSON 2
D Text, String vor einem Root Element einfügen XML & JSON 2
R wie kann ich ein xml file in einen string einlesen? XML & JSON 2
E Element.setTextContent(String); Ersatz fuer Version 1.4? XML & JSON 3
C xml validierung gegen xsd mit jdom: Fehlermeldung Cannot find the declaration of element ... XML & JSON 8
S Cannot find the declaration of element XML & JSON 2
S XML Validierung mit XSD über DOM - Cannot find. XML & JSON 4

Ähnliche Java Themen

Neue Themen


Oben