Issue
I have a project on Gitlab that should download files to its current directory (regardless of user OS being Mac/Windows) when the user downloads the repo and uses it on locals. Also, I will read the same file again further in the program.
Can anyone suggest to me what directory name should I pass in the python variable to achieve this?
Thank you
Solution
If you want to download to the same folder as your python file, you can do
from pathlib import Path
dir_to_download_to = Path(__file__).parent
If you want to download to the same folder as the user is in, then
import os
dir_to_download_to = os.getcwd()
Answered By - user3808430 Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.