Python Python:取得 hostname (FQDN / Short) 用 socket 或是 platform module 來達成這件事: socket 1 2 3 4 5 6 7 import socket # FQDN socket.gethostname() # Short socket.gethostname().split(".")[0] platform 1 2 3 4 5 6 7 import platform # FQDN platform.node() # Short platform.node().split(".")[0] REF {#ref}: https://stackoverflow.com/questions/30185706/what-is-the-correct-way-of-getting-a-base-or-short-hostname