小册名称:Python合辑4-130个字符串操作示例
检查字符串是否以Python中的给定字符串或字符结尾
txt = "Canada is a great country"x = txt.endswith("country")print(x)
txt = "Canada is a great country"
x = txt.endswith("country")
print(x)
Output:
True