How can you set your path = Path to automatically be a users Downloads folder?

Question:

I am wanting to set up a system of CSV formatters in conjunction with a PySimpleGUI program. I want the output file to go to the users Downloads folder, but currently I know how to only use the Path method for my own Downloads folder. If I packaged this up, it would not be dynamic.

path = Path(r"C:\Users\xxx.xxxxx\downloads\Finished_File.csv")

I am unsure of other ways to go about auto-filling the user info without inputting it manually

My only other thinking is perhaps have this change dynamically with PySimpleGui using a list of potential names, and then having the user set who they are?

Asked By: Pongotan

||

Answers:

Find it manually before saving uisng pathlib

from pathlib import Path
users_download_path = str(Path.home() / "Downloads")
res =str( users_download_path) + '' + str('Finished_File.csv')
path = Path(res)
Answered By: Bhargav
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.