Tim Chase wrote:
success = None
for i in range(5):
#Try to fetch public IP
success = CheckIP()
if success:
break
if not success:
print Exiting.
sys.exit()
Though a bit of an abuse, you can use
if not any(CheckIP() for _ in range(5)):
print Exiting
success = None
for i in range(5):
#Try to fetch public IP
success = CheckIP()
if success:
break
if not success:
print Exiting.
sys.exit()
Though a bit of an abuse, you can use
if not any(CheckIP() for _ in range(5)):
print Exiting
sys.exit()
I don't see
Gilles Ganault wrote:
Hello
As a newbie, it's pretty likely that there's a smarter way to do this,
so I'd like to check with the experts:
I need to try calling a function 5 times. If successful, move on; If
not, print an error message, and exit the program:
=
success = None
for
On Thu, Nov 20, 2008 at 11:58 PM, Steve Holden [EMAIL PROTECTED] wrote:
Gilles Ganault wrote:
Hello
As a newbie, it's pretty likely that there's a smarter way to do this,
so I'd like to check with the experts:
I need to try calling a function 5 times. If successful, move on; If
Tim Chase wrote:
success = None
for i in range(5):
#Try to fetch public IP
success = CheckIP()
if success:
break
if not success:
print Exiting.
sys.exit()
Though a bit of an abuse, you can use
if not any(CheckIP() for _ in range(5)):
print Exiting
Hello
As a newbie, it's pretty likely that there's a smarter way to do this,
so I'd like to check with the experts:
I need to try calling a function 5 times. If successful, move on; If
not, print an error message, and exit the program:
=
success = None
for i in range(5):
#Try to
I need to try calling a function 5 times. If successful, move on; If
not, print an error message, and exit the program:
success = None
for i in range(5):
#Try to fetch public IP
success = CheckIP()
if success:
break
if not success:
print Exiting.
Gilles Ganault [EMAIL PROTECTED] wrote:
As a newbie, it's pretty likely that there's a smarter way to do this,
so I'd like to check with the experts:
I need to try calling a function 5 times. If successful, move on; If
not, print an error message, and exit the program:
=
success = None
for
On Nov 19, 2008, at 09:09, Gilles Ganault wrote:
Hello
As a newbie, it's pretty likely that there's a smarter way to do this,
so I'd like to check with the experts:
I need to try calling a function 5 times. If successful, move on; If
not, print an error message, and exit the program:
=
On 19 Nov 2008 14:37:06 + (GMT), Sion Arrowsmith
[EMAIL PROTECTED] wrote:
Note very carefully that the else goes with the for and not the if.
Thanks guys.
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 19, 10:21 am, Gilles Ganault [EMAIL PROTECTED] wrote:
On 19 Nov 2008 14:37:06 + (GMT), Sion Arrowsmith
[EMAIL PROTECTED] wrote:
Note very carefully that the else goes with the for and not the if.
Thanks guys.
And if you end up doing this for several different functions, you can
11 matches
Mail list logo