📜  如何使用 python 代码示例获取 pc 名称

📅  最后修改于: 2022-03-11 14:45:19.552000             🧑  作者: Mango

代码示例1
# credit to the Stack Overflow user in the source link

import platform
platform.node()
>>>'DARK-TOWER'

# or equivalently

import socket
socket.gethostname()
>>> 'DARK-TOWER''