Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Couting the number of lines of code of a python program (http://www.velocityreviews.com/forums/t956165-re-couting-the-number-of-lines-of-code-of-a-python-program.html)

Chris Angelico 01-05-2013 03:25 PM

Re: Couting the number of lines of code of a python program
 
On Sun, Jan 6, 2013 at 2:17 AM, chaouche yacine
<yacinechaouche@yahoo.com> wrote:
> defcount_loc(lines):nb_lines =0docstring =Falseforline inlines:line =line.strip()ifline ==""\ orline.startswith("#")\ ordocstring andnot(line.startswith('"""')orline.startswith("'' '"))\ or(line.startswith("'''")andline.endswith("'''")an dlen(line)>3)\ or(line.startswith('"""')andline.endswith('"""')an dlen(line)>3):continue# this is either a starting or ending docstringelifline.startswith('"""')orline.startswi th("'''"):docstring =notdocstring continueelse:nb_lines +=1returnnb_lines


Ow-what? Something's gone wrong with all your whitespace, I think...
can you paste again please?

ChrisA


All times are GMT. The time now is 01:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.