问题
I want to change DNS servers programmatically. I don't want to build a DNS server, I just want to change the primary and secondary dns servers automatically. This work needs to be done in Python.
回答1:
You can call a command line tool to do it for you with os.system.
import os
os.system('netsh interface ip set dns "Local Area Connection" static 192.168.0.200')
来源:https://stackoverflow.com/questions/7415771/how-to-change-dns-servers-programmatically-in-windows