Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

# check if the file is not empty and get size

# check if the file is not empty and get size
import os
def is_empty_file(fpath):
  return os.path.isfile(fpath) and os.path.getsize(fpath) > 0

fp="/content/sample_data/california_housing_test.csv"

emp_status= is_empty_file(fp)
print(emp_status)
 
PREVIOUS NEXT
Tagged: #check #file #empty #size
ADD COMMENT
Topic
Name
4+9 =