#STRING INDEXtxt = "Hello, Hello to my world."x = txt.index("Hello")print(x) #If the value is not found, the find() method returns -1, but the index() method will raise an exception:txt = "Hello, welcome to my world."print(txt.find("q"))print(txt.index("q"))
No comments:
Post a Comment