which lines are indentation errors | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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 Answers
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