【发布时间】:2016-06-01 08:23:42
【问题描述】:
我有一个字符串:
myStr = "Chicago Blackhawks vs. New York Rangers"
我还有一个清单:
myList = ["Toronto Maple Leafs", "New York Rangers"]
使用 endswith() 方法,我想编写一个 if 语句来检查 myString 是否以 myList 中的任一字符串结尾。我有基本的 if 语句,但我不知道应该在括号中放什么来检查它。
if myStr.endswith():
print("Success")
【问题讨论】:
标签: python python-3.x python-2.7 ends-with