Python Programming - Reading and Writing Files - Discussion

Discussion Forum : Reading and Writing Files - General Questions (Q.No. 30)
30.
How can you check if a file named "data.csv" is empty?
if not is_empty("data.csv"):
if get_size("data.csv") == 0:
if file_empty("data.csv"):
if os.path.getsize("data.csv") == 0:
Answer: Option
Explanation:
Using os.path.getsize() to check if the file size is 0, indicating an empty file.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.