0

I am making a python script as a school project but I have been using my own user in order to use a file path, but I want to make it so that I can use this program on other devices, please, can someone help

verwro
  • 1
  • 1

1 Answers1

0

You can use the os library for this.

import os
user_name = os.getlogin()

os.getlogin() returns the currently logged in user's user name as a string. Here is the documentation.