Python: ValueError: min() arg is an empty sequence -
i trying find added file of specific type (.csv) in folder. getting error.
here code:
import glob newest = min(glob.iglob('results/*.csv'), key=os.path.getctime) here error getting:
valueerror: min() arg empty sequence
what causing valueerror , how resolve it?
thanks in advance
you don't have .csv files in target location.  try following should return none in such case.
my_glob = glob.glob('results/*.csv') newest = min(my_glob, key=os.path.getctime) if my_glob else none 
Comments
Post a Comment