python,关键词pass

for letter in 'python':
    if letter == 'h':
        pass
        print " This is pass block"
    print "Current letter:", letter

print " Goodbye"

for letter in 'Patrick':
    if letter == 'r':
        pass
        print "This is pass block"
    print "Current letter:", letter
print "Goodbye"

It is used when a statement is required syntactically but you do not want any command or code to execute.
The pass statement is a null operation; nothing happens when it executes. The pass is also useful in places where your code will eventually go, but has not been written yet (e.g., in stubs for example):

你可能感兴趣的:(python,关键词pass)