string.find用于不区分大小写的搜索 [英] string.find for case insensitive search

查看:1696
本文介绍了string.find用于不区分大小写的搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我需要使用不区分大小写的子字符串,有没有一种方法如何使用string.find函数来查找

子字符串?

感谢您的回复

LL

Is there a good way how to use string.find function to find a
substring if I need to you case insensitive substring?
Thanks for reply
LL

推荐答案

" Johny" < py **** @ hope.czwrote:
"Johny" <py****@hope.czwrote:

有一个很好的方法如何使用string.find函数找到一个

substring如果我需要你不区分大小写的子串?
Is there a good way how to use string.find function to find a
substring if I need to you case insensitive substring?



s.lower()。find(substring.lower())

s.lower().find(substring.lower())


lower ()也不赞成:)哦好吧


2007年2月7日21:06:08 GMT,Duncan Booth< du ********** @无效。 invalidwrote:
lower() is also deprecated :) oh well

On 7 Feb 2007 21:06:08 GMT, Duncan Booth <du**********@invalid.invalidwrote:

" Johny" < py **** @ hope.czwrote:
"Johny" <py****@hope.czwrote:

有一个很好的方法如何使用string.find函数找到一个

substring如果我需要你不区分大小写的子串?
Is there a good way how to use string.find function to find a
substring if I need to you case insensitive substring?



s.lower()。find(substring.lower())


-
http://mail.python.org/mailman/listinfo/python-list


Johnyaécrit:
Johny a écrit :

有一个好方法如何使用string.find函数找到一个

子串如果我需要你不区分大小写的子串?
Is there a good way how to use string.find function to find a
substring if I need to you case insensitive substring?



" abCdZEd" .lower()。find(" BcD" .lower())

"abCdZEd".lower().find("BcD".lower())


这篇关于string.find用于不区分大小写的搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆