[Tutor] How to discover which OS my python is running?

bob bgailer at alum.rpi.edu
Thu Nov 24 05:50:58 CET 2005


At 06:31 PM 11/23/2005, Diego Galho Prestes wrote:
>Hi! I'm using a program that I want to know if I'm running the program
>in Linux or Windows. How can I do this? I want this because I created
>all my program in Linux but if someone runs it in Windows I have to do
>some things to make it work well, and I want to do this verification
>automatically.

import os
print os.name
# on my system I get nt
# The following names have currently been registered: 'posix', 'nt', 
'mac', 'os2', 'ce', 'java', 'riscos'. 



More information about the Tutor mailing list