Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

PREVIOUS NEXT
Code Example
Python :: items of list 
Python :: Reversing Ints 
Python :: how to input a picture into opencv raspberry pi 
Python :: df to dict 
Python :: how to pre populate field flask wtforms 
Python :: geopandas with postgis 
Python :: python projects 
Python :: python dictionary get vs setdefault 
Python :: cv2.imshow not working in vscode 
Python :: how to extract values from a dictionary 
Python :: python remove white space 
Python :: tkinter change button foreground 
Python :: iloc pandas 
Python :: data types in numpy array 
Python :: how to count the number of guesses in python 
Python :: django 3 create async rest api 
Python :: string remove suffix python 
Python :: python iteration 
Python :: how to find a specific word in a list python 
Python :: python check if false in dict 
Python :: duplicate a list with for loop in python 
Python :: python load file with multiple jsons 
Python :: insert function in list 
Python :: python remove first item in list 
Python :: apps to help in coding python exmas 
Python :: convert list to dataset python 
Python :: python ceil method 
Python :: fun games 
Python :: xlabel not showing matplotlib 
Python :: how to do input python 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =