str_search = "DD09"
str_1 = "DD09 High speed status"
Str_2 = "Dd09 High speed status"
str.find (str_search)
print(str)
输出:DD09高速状态
为什么无法打印Str_2
?我如何克服这个问题?
答案 0 :(得分:1)
在搜索前将两个字符串设为小写:
str_search = "DD09"
str_1 = "DD09 High speed status"
Str_2 = "Dd09 High speed status"
position = Str_2.lower().find(str_search.lower())
print(position)