Skip to content

Instantly share code, notes, and snippets.

View nickwhite917's full-sized avatar

Nicholas White nickwhite917

View GitHub Profile
@nickwhite917
nickwhite917 / Python_TSV_Num_Cols.py
Created March 13, 2017 14:25
Print number of columns in a tab-delimited file using Python
import glob, os
for file in glob.glob("your/path/here/*"):
print("{}\t{}".format(os.path.split(file)[1],len(str(open(file,'r').readline()).split('\t'))))