Sometimes, we'd like to process some file (like *.txt), maybe parsing, segmentation, and so on. And Python specialized in string process.
import os f = os.popen("ls *.txt") files = f.readlines() f.close() print len(files) for f in files: print f
It's reference from here.
Subscribe to hothero's TechNote
Get the latest posts delivered right to your inbox