0
How can I find the index of a back slash within a string?
f = open("newFile.txt", "w+") pathName = os.path.abspath(f.name) index = pathName.find(r"\") <-- This needs fixing
1 Réponse
+ 7
You should use a double backslash, that's all.
...find("\\")
just make sure it is the right slash, as you will encounter the regular one in Linux and in Sololearn most likely.