字符串包含

Python 使得检查字符串是否包含给定子字符串非常直观。只需使用 in 运算符:

>>> "foo" in "foo.baz.bar"
True

注意:测试空字符串将始终导致 True:

>>> "" in "test"
True