import os print(os.environ[‘HOME‘])
Python获取Linux的家目录
原文:https://www.cnblogs.com/tarzen213/p/13255251.html