To count the lines in a file:

len(open(filename,'r').readlines())

To list all files and or count them:

import glob
filenames = 
glob.glob('path/*/*.py')+glob.glob('path/*/*.html')+glob.glob('path/*/*/*.html')+glob.glob('path/static/*')++lob.glob('path/static/*/*')+...
print len(filename)

here path is path to the app and ... to add levels depending how nested you 
can go. You can also use os.walk to descent the all folder and find all 
files. 

On Sunday, 11 November 2012 23:37:26 UTC-6, Hector Magnanao wrote:
>
> 1) How do you count the number of files that make up a web2py application ?
> 2) How do you count the lines of code for each file in question 1 ?
>  
> I hope to write a perl script that can do this.
>

-- 



Reply via email to