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

 
 
Dave Angel
Guest
Posts: n/a
 
      01-05-2013
On 01/05/2013 10:17 AM, chaouche yacine wrote:
> <snip>



>
> Here is my implementation :
>
> 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


Wow, this is thoroughly garbled. Please configure your email (yahoo?)
to use text mode email, to not delete spaces, to honor newlines, etc.


>
>
> ----- Original Message -----
> From: Chris Angelico <(E-Mail Removed)>
> To: http://www.velocityreviews.com/forums/(E-Mail Removed)

Why is the quoted part *after* your message? Please don't top-post on
this list (or most of them). It gets too garbled after one or two
generations.



--

DaveA

 
Reply With Quote
 
 
 
 
Roy Smith
Guest
Posts: n/a
 
      01-05-2013
In article <(E-Mail Removed)>,
Dave Angel <(E-Mail Removed)> wrote:

> On 01/05/2013 10:17 AM, chaouche yacine wrote:
> > <snip>

>
>
> >
> > Here is my implementation :
> >
> > 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

>
> Wow, this is thoroughly garbled. Please configure your email (yahoo?)
> to use text mode email, to not delete spaces, to honor newlines, etc.


Nice to know that wasn't just another case of my using an antiquated
news reader
 
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 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 03:25 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