在python中使用boolean时没有得到True或False

时间:2016-03-31 16:49:50

标签: python boolean

 def ping_host(self,host_name):
        """ping host to check if its active"""
        return_responce = os.system('ping -c 1 ' + host_name)
        if return_responce == 0:
            return True
        else:
            return False

1 个答案:

答案 0 :(得分:2)

x=ping_host(self, host_name)
print(x)
相关问题