s = "Hello World"
if s.isalpha() and s.isspace():
print("The string contains only letters and spaces.")
else:
print("The string contains other characters.")
这里,如果 `s` 只包含字母和空格,那么上述代码会输出 "The string contains only letters and spaces."。否则,它会输出 "The string contains other characters."。