- 1

which lines are indentation errors

import os def read_file(file): line = None if os.path.isfile(file): data = open(file.'r') while line != '': line = data.readline() print(line)

28th May 2020, 7:15 AM
Sai Rajveer Kondeti
Sai Rajveer Kondeti - avatar
2 Respostas
0
I don't think indentation error present in your code but you need to refactor your code as below. You need to run while loop only if file is present and opened. import os def read_file(file): line = None if os.path.isfile(file): data = open(file.'r') while line != '': line = data.readline() print(line)
28th May 2020, 7:50 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
+ 1
why do u think there are errors?
28th May 2020, 7:27 AM
Oma Falk
Oma Falk - avatar