Getting User From Within Python Script

This question already has an answer here:

  • Is there a portable way to get the current username in Python? 11 answers

  • As noted in my comment, the answer is given here: https://stackoverflow.com/a/842096/2531279

    Note: this is available for Windows and Unix


    Wouldn't it depend on what OS you are running the script on? Running shell commands is more common on some flavor of Linux but it could be a windows or Mac machine. Python may have a way of doing that cross platform, i'm not sure.

    链接地址: http://www.djcxy.com/p/79424.html

    上一篇: 我如何在python中动态生成文件名?

    下一篇: 从Python脚本中获取用户