Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8597

Python • Re: Python string find index

$
0
0
You are starting to look at the index of the "|". You need to start looking 1 past

Code:

chr2 = "Some Text | More Text text | still more text | last text"index0 = chr2.find("|")index1 = chr2.find("|", index0+1)index2 = chr2.find("|", index1+1)index3 = chr2.find("last")print(index0,index1,index2,index3)

Statistics: Posted by DS256 — Wed Apr 16, 2025 11:01 pm



Viewing all articles
Browse latest Browse all 8597

Trending Articles