Hi, I am trying to have a file path like 'C:\Programfiles\file.txt' but i would like to have file.txt be a variable that i can change whenever i need to. I am trying to compare 2 directories then copy files from one to another if they arent already there. i have this code so far.
import os
import shutil
A= set(os.listdir(r"C:\Users\Morpheous\Desktop\Python Test"))
B= set(os.listdir(r"C:\Users\Morpheous\Desktop\Python Test 2"))
if len(A)< len(B):
C=B-A
print("File is: %s" %(C))
shutil.copy2('C:\\Users\\Morpheous\\Desktop\\Python Test 2\\%r'%(C),'C:\\Users\\Morpheous\\Desktop\\Python Test')
elif len(A) > len(B):
C=B-A
print(C)
and i get an error because the variable is inserted into path with {''} around it. How would i go about doing this?