Skip to content

How to get pc name with Python?

# credit to the Stack Overflow user in the source link

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

# or equivalently

import socket
socket.gethostname()
>>> 'DARK-TOWER''
See also  How to use goto in Python turtle?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.