-3

I came across this interesting question my friend asked me. He told that he found a way to know which os we are on without importing the os module. Can any of you help me with the same?

ForceBru
  • 41,233
  • 10
  • 61
  • 89

2 Answers2

1
import platform
print(platform.system())
print(platform.release())
print(platform.version())
liagason
  • 101
  • 1
  • 10
0

perhaps this could work:

if r"\" in __file__: print("Windows") 
else: print("Unix variant")
Alain T.
  • 34,859
  • 4
  • 30
  • 47