+ 1

Need to search a string in text file irrespective of case sensitive

https://code.sololearn.com/co3DMeQvBn88/?ref=app Please help me

20th May 2020, 12:13 PM
Raj Charan
2 ответов
+ 2
If you just need to determine whether the text is in the file or not, try the following: with open("test.txt") as f: if 'Apple'.lower() in f.read().lower(): print('yes') (or switch "Apple" to anything, a variable which you can convert to lowercase on-the-fly) But... if you need a more sophisticated search, try learning regex and use it: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2475/
20th May 2020, 12:28 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Thank you
20th May 2020, 1:02 PM
Raj Charan