[Tutor] Vol 127, Issue 15

Alan Gauld alan.gauld at btinternet.com
Sat Sep 6 01:34:54 CEST 2014


On 05/09/14 23:11, Alan Gauld wrote:

> Let's translate that to Python
>
> count = 1
> error = subprocess.Popen('command')  # execute once

oops, that should be subprocess.call()

sorry.

> while error and count < 3:           # if error and less than 3
>     error = subprocess.call('command')   # on success call() returns zero
>     count += 1

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list