[Tutor] 2 problems in a small script

Aditya Lal aditya.n.lal at gmail.com
Fri Oct 12 12:09:39 CEST 2007

w.r.t. prob 2, there is no break/continue in the code that you have given. I
added the "break" statement after you remove the word from lstB and code
does seems to work for me.

  <snip />
            if word in lstB:
                print "Removed", word
  <snip />

Can you specify where did you try putting break/continue ?

On 10/12/07, Dick Moores <rdm at rcblue.com> wrote:
> At 10:53 PM 10/11/2007, Dick Moores wrote:
> >Please see the code and it's output here:
> ><http://www.rcblue.com/Python/buggy_For_Web.py>
> >
> >
> >I'm attempting to eliminate the elements (strings) of lstA that are
> >not well-formed in that they contain at least one character that is
> >not in the string astr.
> >
> >Problems:
> >1) If lstA[n] is removed, lstA[n+1] is skipped--isn't examined at
> >all, and remains in the final form of lstA whether well-formed or not.
> >
> >Using print statements is as far as my debugging skills go, so you
> >can see of bunch of them in the code. I did try to use winpdb for the
> >first time, but haven't figured it out yet. Ulipad now has it built
> >in, so I'd like to learn to use it it..
> >
> >2) I'm not able to get the "for char in wordWithCommas:" loop to stop
> >examining a wordWithCommas after it's word has been removed. I've
> >tried "continue" and "break" in various places to no avail.
> >
> >I'd appreciate some help.
> Now that Aditya and Alan have come to my rescue, problem #1 has been
> solved. But #2 remains..
> Dick
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071012/bfe5e7d8/attachment.htm 

More information about the Tutor mailing list