x = input("Please enter the character you wish to search for:")
file = open("C:\\Users\\Murphy\\Desktop\\names.txt", "r")
a_string = file.read().count(x)
print(a_string)
该代码工作正常,但我不知道如何使字符搜索不区分大小写。
x = input("Please enter the character you wish to search for:")
file = open("C:\\Users\\Murphy\\Desktop\\names.txt", "r")
a_string = file.read().count(x)
print(a_string)
该代码工作正常,但我不知道如何使字符搜索不区分大小写。