python判断字符串间的包含关系 1.in a = 'helloll' b = 'll' print(b in a) 输出: True 2.find a = 'helloll' b = 'll' print(a.find(b)) 输出: 2 find会返回b在字符串a中第一次出现的索引值,索引值从0开始,a[0]=‘h’,a[1]=‘e’,a[2]=‘l’,所以返回2 3.rfind a = 'hellolloll' b = 'll' print(a.rfind(b)) 输出: 8 find会返回b在字符串a中最后一次出现的索引值