0

Why is this code searching for the file instead of creating it?

import os, re f = open("newFile.txt", "w+") pathName = os.path.abspath(f.name) pattern = r"\\" count = list(x.start() for x in re.finditer(pattern, pathName)) os.remove(pathName) #HERE f = open("C:\\Users\\" + pathName[count[1]+1:count[2]-1] + "\\Desktop\\newFile.txt", "w+")

30th May 2020, 9:16 PM
Jeremy Cruz
Jeremy Cruz - avatar
2 Antworten
+ 1
Your query is not clear from your code. Could you please explain more?
31st May 2020, 4:56 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
+ 1
I fixed it nvm
31st May 2020, 4:57 AM
Jeremy Cruz
Jeremy Cruz - avatar