今天照抄了一段代码,是这样子的:
1 2 3 4 5 6 7 8 9 10 11 12 13 | import ctypes, sys def is_admin(): try: return ctypes.windll.shell32.IsUserAnAdmin() except: return False if is_admin(): # Code of your program here else: # Re-run the program with admin rights ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1) |
运行的时候出大问题:expected an indented block
解决方法:在If语句后面写点东西啊,你if后头啥都没有还写啥啊
就像这样,if语句后面整点东西

如果不是这个问题的话就是你tab或者是空格写错了,Python要是多写少写一个空格,就能要了Python的命
发表回复