发布时间:2019-09-25 08:21:37编辑:auto阅读(3676)
python获取当前用户的主目录路径, 示例代码如下:
#! /usr/bin/python
# -*- coding: utf-8 -*-
import os
print os.environ['HOME']
print os.path.expandvars('$HOME')
print os.path.expanduser('~')
上一篇: Python(3)
下一篇: 如何在同一台电脑(windows系统)上
48976
48110
38850
35981
30396
27179
26170
21009
20843
19202
44°
57°
53°
733°
801°
782°
789°
766°
716°
844°