(using Python 3.12.2) I have a multiplelines file called "text.txt" and it has 3 lines, it goes like this:
line 1 --> Hello, World!
line 2 --> MrBeast is rich.
line 3 --> :3 avg valorant player
However I would like to print only the line that has the "World" independent of the line it is located, which means I have to find the desired line first. I have been searching for a function that would do this for me and have come to the conclusion that there is maybe no such thing as variable.lineindex("desired_string") and will have to code it myself, any suggestions or am I being a moron?
You can break in if block if you need only the first occurence.