用find查询字符串内字符的位置,第一个符合的字符位置,find不存在返回-1,index会报错
a="i love chian"
fnd=a.find('i')
idx=a.index("n")
print("字符串a中字符i的位置为:%d"%fnd)
print("字符串a中字符n的位置为:%d"%idx)
判断字符串a是否在字符串b里,返回布尔值
a='chian'
b='i love chian'
s= a in b
print(s)
统计字符串内字符的个数
a="i love chian"
cnt=a.count('i')
print("字符串a中字符i的个数为:%d"%cnt)
判断字符串的字母不重复
https://blog.csdn.net/GrofChen/article/details/92406250