Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Couting the number of lines of code of a python program

Reply
Thread Tools

Re: Couting the number of lines of code of a python program

 
 
Chris Angelico
Guest
Posts: n/a
 
      01-05-2013
On Sun, Jan 6, 2013 at 2:17 AM, chaouche yacine
<(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Couting the number of lines of code of a python program Dave Angel Python 1 01-05-2013 03:40 PM
Re: Couting the number of lines of code of a python program chaouche yacine Python 0 01-05-2013 03:38 PM
Re: Couting the number of lines of code of a python program Chris Angelico Python 0 01-05-2013 02:09 PM
Couting the number of lines of code of a python program chaouche yacine Python 0 01-05-2013 01:55 PM
Reading contents for a text file and couting words jazzy Java 3 05-25-2004 06:50 AM



Advertisments