python环境: python 2
使用函数:endswith函数
line = "你好呀“
element = "呀”
line.endswith(element)
返回:
True
另,菜鸡发言:在python2中要非常注意中文字符串的编码问题,看是否需要使用.decode("utf-8)
和.encode('utf-8)
。
python环境: python 2
使用函数:endswith函数
line = "你好呀“
element = "呀”
line.endswith(element)
返回:
True
另,菜鸡发言:在python2中要非常注意中文字符串的编码问题,看是否需要使用.decode("utf-8)
和.encode('utf-8)
。