For loop

Boris Ottlewski Boris.Ottlewski at NOSPAMsystemsoft.de
Mon Mar 20 10:41:12 CET 2000


I have completely overlooked that python NEEDS the tabs... :o)

cheerio...
Boris
"Gordon McMillan" <gmcm at hypernet.com> wrote in message
news:1258990590-4218974 at hypernet.com...
> Boris Ottlewski wrote:
> >
> > I got this code snipet: (See the colons!)
> >
> > for a in i.something():
> >      for cf in a.somethingelse():
> >           print cf.property
> >
> > It works in python.exe (shell). How do I use this in embedded python?
When a
> > build a string with this code and do a Py_RunSimpleString() it raises a
> > syntax error. Is there an alternative syntax? Is the colon someting just
> > known to the python shell?
>
> Make sure the lines are delimited properly, and the parser can
> detect a dendent and end-of-file:
>
> "for i in a:\n for j in b: \n  something\n\n\0"
>
> - Gordon
>





More information about the Python-list mailing list