亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

以管理員身份運行 python 文件

以管理員身份運行 python 文件

神不在的星期二 2023-12-29 15:10:37
我正在嘗試創建一個程序,要求任何網站的用戶鏈接阻止它(在主機中)import requestsprint('Time to block some websites')ask = input('> Give me the link... ') ; link = {} # Ask usertry:    r = requests.get(ask) # Try the url     print('Protocol : ' , r.url [:r.url.find(":")]) # Check protocol of the url    url = r.url     print('your url : ' , url)except:    raise ValueError('Give the url with https/http', ask)url = url.split('/') ; urlist = list(url) # Split url link.update({'linko': urlist[2]}) ; link.update({'host': '127.0.0.1 '}) # Add host and url to linkx = link['linko'] ; y = link['host'] # Transform value of dict in stringz = str(y+x) # Assign host and linkf = open('hosts', 'a') # Open document in append modef.write(z) ; f.write('\n') # Write z and newline for future usef.close() # Always close after usef = open('hosts' , 'r') # Open document in read modeprint(f.read()) # Read documentf.close() # Always close after use追溯 :  File "C:\Windows\System32\drivers\etc\block.py", line 17, in <module>    f = open('hosts', 'a') # Open document in append modePermissionError: [Errno 13] Permission denied: 'hosts'當我嘗試使用 runas 管理員執行程序時:RUNAS ERROR: Unable to run - C:\Windows\System32\drivers\etc\block.py193: C:\Windows\System32\drivers\etc\block.py is not a valid Win32 application. 如何讓程序有權向主機添加站點?
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 131 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號