filesystem.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Solfege 作者: RannyeriDev 项目源码 文件源码
def _get_home_dir():
    ''' Try to find user's home directory, otherwise return current directory.'''
    path1 = os.path.expanduser("~")
    try:
        path2 = os.environ["HOME"]
    except KeyError:
        path2 = ""

    try:
        path3 = os.environ["USERPROFILE"]
    except KeyError:
        path3 = ""

    if not os.path.exists(path1):

        if not os.path.exists(path2):

            if not os.path.exists(path3):
                return os.getcwdu()

            else: return path3

        else: return path2

    else: return path1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号