fPath = raw_input('File Path:')
counter = 0;
flag = 0;
with open(fPath) as f:
content = f.readlines()
for line in content:
if flag == 0 and line.find("WECS number") or \
line.find("WECS number") or \
line.find("WECS name") or \
line.find("Manufacturer") or \
line.find("Type") or \
line.find("Nominal effect") or \
line.find("Hub height") or \
line.find("x (local)") or \
line.find("y (local)") or \
line.find("x (global)") or \
line.find("y (global)"):
if not line.find("y (global)"):
print ("Alert Last Line!");
else:
print("Alert Line!");
For some reason, the code seems to be printing "Alert Line!" if a line is just "\n". My intent in creating the "if and or" structure was to ignore all lines not containing the strings listed in the line.find's. Something is going wrong here...
How can I fix this problem?
content=f.readlines(); for line in content:just dofor line in f:.