python get desktop directory

Solutions on MaxInterview for python get desktop directory by the best coders in the world

showing results for - "python get desktop directory"
Alessandro
21 Aug 2020
1You can use os.environ["HOMEPATH"] to get the path. Right now it's literally trying to find %HOMEPATH%/Desktop without substituting the actual path.
2
3Maybe something like:
4
5shutil.copy(txtName, os.path.join(os.environ["HOMEPATH"], "Desktop"))