11智能在线
新记
在Python中,如何检查字符串是否只包含某些字符
如题所述
举报该文章
相关建议 2018-07-16
#假如你的某些字符是s和a
some_letter = ["s","a"]
ss = "sadsahchcdsc"
other_letters = []
for s in ss:
if not some_letter.count(s):
other_letters.append(s)
flag = True
if other_letters:
print "
字符串
含有别的字符",other_letters
温馨提示:内容为网友见解,仅供参考
当前网址:
https://11.t2y.org/zz/f7p88s722svvq4pvqs.html
其他看法
无其他回答
相似回答
大家正在搜
相关问题
python re模块如何判断字符串中包含某些特定字符?如文...
如何检查字符串是否包含Python中列表中的元素
用python语言,如何判断一段字符串中是否包含指定的字符串...
python中如何判断指定字符串是否在文件中
python3判断是字符串中包含某些特定字符
如何判断字符串中,包含子字符串
python 查找字符串中是否包含指定非连续字符
python如何检测字典的键中是否含有某串字符?