0
Program taking all entries of the input file as one entry!
In this code all entries in the input.txt files are taken as one entry, whereas I want each entry to go through the operations independently and then outputs written for each entry against it. Please help The code is: https://code.sololearn.com/chBdJsFfAnGz/#py
4 Answers
+ 1
This is because you use file.read method, which reads all the file contents. thy yo use readline() if you want to iterate through the file reading a single line at a time
0
have you tried a for loop on your input function? I feel like you can do something like:
def input_fct():
# input function for getting the data from (input.txt)
file = open("input.txt", "r")
for each in file:
inpt = each.read() # input txt file
return inpt
not sure, haven't tested this exact code, but I feel like filtering input would be a place to start.
0
@strawdog
In that case I am having this error
https://prnt.sc/l66stl
0
@Steven M
An attribution problem is appearing in that case.
https://prnt.sc/l66uox
Please have a look at the code if possible. I am stuck in between,