Wiki
Books
Shop
Courses
Careers
Change language
English
Italiano
Deutsch
Français
Español
Türk
Русский
Português
Polski
Nederlandse
中文
한국어
日本語
हिन्दी
Python.Engineering
Wiki
在 Python 中獲取主目錄的正確跨平台方法是什麼?
在 Python 中獲取主目錄的正確跨平台方法是什麼?
code Python module
|
Ev PHP module
|
io Python module
|
os Python module
|
platform Python module
|
Python functions
|
re Python module
|
StackOverflow
Michael Zippo
11.03.2022
我需要獲取當前登錄用戶的主目錄位置。目前,我一直在 Linux 上使用以下內容:
os.getenv("HOME")
但是,這在 Windows 上不起作用。正確的跨平台方法是什麼?