How can I rewrite the below code using only single if condition instead of two if conditions in Python 3.7?
with open('demo.csv', 'r') as f, open("Result_csv.csv", 'w+') as out:
for line in f:
if '/tcp' in line:
print(line)
out.write(line)
if '/udp' in line:
print(line)
out.write(line)