-2

Is there any way that we can print the user name of the person who has logged in the system in the file? the file is an output file of python.

4

1 回答 1

3

你可以调查一下os.environ

In [1]: import os

In [2]: os.environ['LOGNAME']
Out[2]: 'lev'
于 2012-06-19T16:46:31.507 回答