I'm not a programmer, so a very dumb Python question here.
So, I have a script that checks whois information for a list of domains. Here is a small example to show my problem:
import pythonwhois as whois
domainList = ['aaaa', 'bbbb', 'ccccc', 'example.com']
def do_whois(domain):
try:
w = whois.get_whois(domain)
print 'Everything OK'
return w
except:
print 'Some error...'
whois_loop()
def whois_loop():
while domainList:
print 'Starting loop here...'
domain = domainList.pop()
w = do_whois(domain)
print 'Ending loop here...'
whois_loop()
Script output using a valid domain:
Starting loop here...
Everything OK
Ending loop here...
Starting loop here...
Some error...
Starting loop here...
Some error...
Starting loop here...
Some error...
Ending loop here...
Ending loop here...
Ending loop here...
My goal:
- When the do_whois () function fails (due to an invalid domain for example), whois_loop () should be continued from the beginning of the next domain.
What? I do not understand:
- while_loop(), , w = do_whois (domain), do_whois()
? " ..."
" ...", ,
. while ,
(, , ).
, , if while_loop():
w = do_whois(domain)
if not w:
continue
print 'Ending loop here...'
:
Starting loop here...
Everything OK
Ending loop here...
Starting loop here...
Some error...
Starting loop here...
Some error...
Starting loop here...
Some error...
, , , - , , , ? , , - .
, , , , .
!