My conditional function is not working. Where is the issue?
From the below text, if "DFF Manufacturing Company" available, then it will print the name.
DFF DFF Manufacturing Company QWE LIMITED
DFF Strasse 16 O Strasse 103
96032, Germany 23467, Germany
Python code:
if "DFF Manufacturing Company" in text.split('\n'):
print("DFF Manufacturing Company")
Output:
No result is showing
>Solution :
if you want to split lines and need to check every line, you have to check by loop.
for line in text.split('\n'):
if "DFF Manufacturing Company" in line:
print("DFF Manufacturing Company")
#break #if you want to check once
if you want to check in full paragraph , use below code
if "DFF Manufacturing Company" in text:
print("DFF Manufacturing Company")