0

I try to get the username in a variable on mac OS. In mac terminal the code is:

 $USER

I tried to do this in python with

import os
os.system('$USER')

The output of these lines give me a number. Any tips for a solution to get the name for mac/python

1 Answers1

1

USER is an environment variable. To access it use:

import os
os.environ['USER']
Boris
  • 66
  • 1
  • 1
  • 5