Reputation: 163
I am creating one Image Viewer app in python. For that I want to get all the pictures from Pictures folder in windows 10.
As you know that I can get all images from: C:\Users\user_name\Pictures
I can use Path module to get all images files from this folder but that program will only work in my pc because I am typing my user name. User name will be different in different Pcs.
So, I want to know which user is logged in windows 10 and get all the images dynamically which can work in all Pcs. I have no idea how to know the user name. Please help me.
Thanks in advance
Upvotes: 0
Views: 501
Reputation: 666
You may be able to use pathlib.Path.home()
as answered here: https://stackoverflow.com/a/4028943/7793122
Upvotes: 2