I can't manage to make this code work
import os
source = "juan.txt"
destination = "C:\\Users\\%username%\\Desktop\\juan.txt"
try:
if os.path.exists(destination):
print("There is already a file there")
else:
os.replace(source, destination)
print(source, "was moved")
except FileNotFoundError:
print("File not found")
When I change %username% to my actual username it works, but I really need code that will allow me to replace this placeholder with the same value without the user knowing it.