1import os, os.path
2
3# simple version for working with CWD
4print len([name for name in os.listdir('.') if os.path.isfile(name)])
5
6# path joining version for other paths
7DIR = '/tmp'
8print len([name for name in os.listdir(DIR) if os.path.isfile(os.path.join(DIR, name))])
9