擅长:python、mysql、java
<p>如果你不介意使用一个小的第三方软件,你可以使用<a href="http://www.nirsoft.net/utils/netresview.html" rel="nofollow noreferrer">Netresview</a>在windows系统上运行良好,避免重新发明轮子和所有这些。你可以做这种事。</p>
<pre><code>os.system('NetResView.exe /DisplayComputers 1 /RetrieveIPAddresses /stext ipfile')
my_file = open('ipfile')
for line in my_file :
print myfile.readline()
</code></pre>