字串包含

Python 使得檢查字串是否包含給定子字串非常直觀。只需使用 in 運算子:

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

注意:測試空字串將始終導致 True:

>>> "" in "test"
True