C
chad
Given the following..
#!/usr/bin/python
import urllib2
import sys
import time
while 1:
try:
con = urllib2.urlopen("http://www.google.com")
data = con.read()
print "connected"
#The loop doesn't exit if I use sys.exit(1)
break
except:
time.sleep(2)
If I would replace 'break' with 'sys.exit(1)', the while loop will
keep printing connected every 2 seconds? Why I this? I thought exit
meant exit.
#!/usr/bin/python
import urllib2
import sys
import time
while 1:
try:
con = urllib2.urlopen("http://www.google.com")
data = con.read()
print "connected"
#The loop doesn't exit if I use sys.exit(1)
break
except:
time.sleep(2)
If I would replace 'break' with 'sys.exit(1)', the while loop will
keep printing connected every 2 seconds? Why I this? I thought exit
meant exit.