如何在没有正则表达式的情况下不区分大小写地搜索字符串?

use*_*730 1 python

我想在文件中搜索包含给定字符串的所有行而不匹配大小写.如何使此代码不区分大小写?

with open(logfile) as inf:
    for line in inf:
        if var in line:
            print 'found',line
Run Code Online (Sandbox Code Playgroud)

jam*_*lak 6

with open(logfile) as fin:
    for line in fin:
        if var.lower() in line.lower():  # makes this case insensitive
            print 'found', line.rstrip() # You will be printing double new lines 
                                         #  without rstrip here
Run Code Online (Sandbox Code Playgroud)