Monday, 7 October 2013

python preventing NONE return function

class sam:

        def sam1(self,d):
                if ("bash" in d or "jenkins" in d):
                        return d

s=sam()
f=open("/etc/passwd","r")
for i in f.readlines():
        q=s.sam1(i)
        if q is not None:
                print q                   

No comments:

Post a Comment