What this does is that it keeps creating a .txt file that keeps duplicating itself in the path that the program is started, here is the code(that works):
import os
import time
file = "1"
while 1 > 0:
f= open(file + ".txt","a")
time.sleep(1)
file += "1"
So what I'm trying to do is that I want to choose a specified path to create and duplicate the (.txt) file instead of the path where the program is started
One of the things that I tried:
import os
import time
file = "1"
while 1 > 0:
f= open(rC:\Users\PC\Documents\ file + ".txt","a")
time.sleep(1)
file += "1"
But didn't work.
Edit:
Last thing I tried was:
import os
import time
file = "1"
path = "r'C:\Users\Daniel\Documents\'"
while 1 > 0:
f= open(path + file + ".txt","a")
time.sleep(1)
file += "1"
But unfortunatley gave me an error that I havent seen in my whole life: