I'm writing some code to check whether an url is available or not, therefore I make use of a wget-command in Linux and then check whether this is successful (returning a 0) or not returning an 8 However the if then statement seems to give the same result in both cases: Here is my code:
#!/usr/bin/env python import sys import os from datetime import datetime, timedelta today=datetime.now() yesterday= datetime.now() - timedelta(days=1) daybeforeyesterday= datetime.now() - timedelta(days=2) collection = [daybeforeyesterday,yesterday,today] for thisday in collection: checkavailablestring='wget -q -O - http://www.deredactie.be/cm/vrtnieuws/videozone/programmas/journaal/EP_'+thisday.strftime("%y%m%d")+'_JO7 >/dev/null ; echo $?' if os.system(checkavailablestring)==0: print thisday, 'stream is available' else: print thisday, 'stream is not available' Can anyone here tell me what I'm doing wrong. Thanks in advance jean -- http://mail.python.org/mailman/listinfo/python-list