목차
접기
아주 간단합니다.
import socket
print(socket.gethostname())
(base) [root@ip-172-31-14-180 basicPubSub]# python3
Python 3.8.8 (default, Apr 13 2021, 19:58:26)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> print(socket.gethostname())
ip-172-31-14-180.ap-northeast-2.compute.internal
728x90