# Print out 'File is empty!' if nodata.txt is empty if os.path.getsize('nodata.txt') == 0: print("File is empty!")
If nodata.txt was empty the code above would output File is empty.
You can try this yourself below. Try changing 'nodata.txt' to 'data.txt' in line 3 and you will get a different output.
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.
We will keep you Python-motivated if you subscribe below.