1import ctypes, os
2
3def isAdmin():
4 """ Return True/Flase """
5 try:
6 is_admin = (os.getuid() == 0) # if Unis
7 except AttributeError:
8 is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0 # elese if Windows
9 return is_admin