title: Efficiency with "try...except"
body: <p>The code works fine. I just had an efficiency question. In this code I'm using "<code>try</code>...<code>except</code>" to pass an error that would crash the program. The error is caused by the IP address not being reachable. As I said before, the code does its job. I want to know if this the quickest way to see if the IP is reachable and pass it up. It stalls for 30 to 45 seconds if the IP can't be found. Piled up a handful of times this could be rather time consuming.</p>
  
  <pre><code>import win32net
  
  def GetUsers( IP ):
      try:
          Users = win32net.NetGroupGetUsers(IP,'none',0),
      except:
          print IP + ': Was not found!'
      else:
          print IP + ': ' + Users
      return
  
  F = open("C:\Users\*User*\Desktop\IP_List.txt")
  
  for CurrentIP in F.readlines():
      GetUsers(CurrentIP.strip()),
  
  F.close()
  print 'DONE!'
  </code></pre>