lundi 6 avril 2020

exclude files from a list with certain length

I am trying to print list of filenames after certain length being exclude. Below is what I have so far.

import glob
import numpy as np
import pandas as pd

path=r'Directory'
files=glob.glob(path + '/**/*.cod',recursive=True)

for i in files:
    indat = pd.read_csv(i, skiprows=4, header=None, engine='python')
    a=indat[8]
    if len(a) >= 600:
       print() #want a list of file names that the files that have length >=600.

Aucun commentaire:

Enregistrer un commentaire