access as administrator python code example
Example: python is running as administrator
import ctypes, os
def isAdmin():
""" Return True/Flase """
try:
is_admin = (os.getuid() == 0) # if Unis
except AttributeError:
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0 # elese if Windows
return is_admin