I having a .txt
file and need to read it in one function and want to use it in another function in python.
I am reading file with
keyword but we can use open
also like file = open("a.txt", "r", encoding="utf-8")
I Tried:
def read_fun():
with open("a.txt", "r", encoding="utf-8") as file:
for line in file:
"doing something"
**return file**
def operation_on_read():
**file = read_fun()**
for i in file:
"NOT ABLE TO ITERATE HERE ON RETURNED FILE"
So, the above code is not working for me, looking for help.
Thanks, in advance!