with open("test.txt") as f:
y = f.readlines()
z = input("Word : ")
a = z.split()
for count, line in enumerate(y):
if all(j in line for j in a):
print(count+1, line)
I organized it a little bit.
with open("test.txt") as f:
y = f.readlines()
z = input("Word : ")
a = z.split()
for count, line in enumerate(y):
if all(j in line.split() for j in a):
print(count+1, line, end="")
You might have intended this.
© 2024 OneMinuteCode. All rights reserved.