code: def get_user_name():
      
  
      if sys.platform == 'win32':
          #user = os.getenv('USERPROFILE')
          user = os.getenv('USERNAME')
      else:
          user = os.getenv('LOGNAME')
  
      return user
docs: Get user name provide by operating system