How to call a function and print from other program?
I've a textfile.txt
file :
"mouse"
"monitor"
"keyboard"
"wire"
My script firstprogram.py
:
def call():
with open('textfile.txt','r') as f:
input_file = f.readlines()
for line in input_file:
print(line)
My another script secondprogram.py
:
from firstprogram import call
print("hi")
call()
This is my expected output:
hi
mouse
monitor
keyboard
wire