python如何判断字符串是否以某个或者某几个字母或者数字结尾

用endwith()方法可以判断字符串是否以某个或者某几个字母或者数字结尾

1 a = 'auy.geojson'
2 b = 'auy'
3 print(a.endswith('.geojson'))
4 print(b.endswith('.geojson'))

结果

1 True
2 False
3 
4 Process finished with exit code 0

 

posted on 2021-03-26 18:28  方圆几百里Idea  阅读(935)  评论(0编辑  收藏  举报

导航