python环境: python 2
使用函数:endswith函数
line = "你好呀“
element = "呀”
line.endswith(element)
返回:
True
另,菜鸡发言:在python2中要非常注意中文字符串的编码问题,看是否需要使用.decode("utf-8)和.encode('utf-8)。
博客介绍了Python 2环境下使用endswith函数的情况,同时特别提醒在Python 2中要格外注意中文字符串的编码问题,需关注是否使用特定编码处理。
python环境: python 2
使用函数:endswith函数
line = "你好呀“
element = "呀”
line.endswith(element)
返回:
True
另,菜鸡发言:在python2中要非常注意中文字符串的编码问题,看是否需要使用.decode("utf-8)和.encode('utf-8)。
1万+
1139
1083

被折叠的 条评论
为什么被折叠?