"pitarda" <pitarda@gmail. com> writes:
[color=blue]
> How do I get the computer name in python?[/color]
You can use the os module to get it from your environment.
[color=blue][color=green][color=darkred]
>>> import os
>>> os.getenv('HOST NAME')[/color][/color][/color]
'calvin.watters on'
Depending on your operating system, the environment variable you need
might have a different name. For example, I think in Windows you
might try
[color=blue][color=green][color=darkred]
>>> os.getenv('COMP UTERNAME')[/color][/color][/color]
You can see all of the environment variables currently available with
[color=blue][color=green][color=darkred]
>>> os.environ[/color][/color][/color]
Comment