【python】pythonでホスト名をゲット

1 |
import os |
1 2 3 4 |
os.uname() ('Linux', 'ip-172-31-13-213.ap-northeast-1.compute.internal', '4.14.123-111.109.amzn2.x86_64', '#1 SMP Mon Jun 10 19:37:57 UTC 2019', 'x86_64') |
1 2 |
os.uname()[1] 'ip-172-31-13-213.ap-northeast-1.compute.internal' |
1 2 |
os.uname()[2] '4.14.123-111.109.amzn2.x86_64' |