[Python]Position eines Buchstaben in einem String finden?
Hallo Leute, Wie kann ich in Python die Position eines Buchstaben oder Zeichenfolge in einem String ermitteln?
Danke im voraus!
1 Antwort
text = "zuUntersuchenderString"
position = text.find("gesuchteZeichen")
Die Python - Dokumentation dazu:
str.
find
( sub[, start[, end]])
Return the lowest index in the string where substring sub is found within
the slices[start:end]
. Optional arguments start and end are
interpreted as in slice notation. Return-1
if sub is not found.