[Tutor] Python Variables Changing in Other Functions

Wayne Werner waynejwerner at gmail.com
Thu May 26 05:34:21 CEST 2011


On Wed, May 25, 2011 at 10:17 PM, Rachel-Mikel ArceJaeger <
arcejaeger at gmail.com> wrote:

> You asked for the traceback. All I get is this:
> ---------------------
>
> python a2.py
>   File "a2.py", line 20
>     titles = [title in myFile if title not in ["\n",""]]
>
> ^
> SyntaxError: invalid syntax
>

Ahah. You're missing the important part:

titles = [title for title in myFile if title not in ["\n",""]]

you're missing the "title for" part. That should fix it.

HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110525/2d2d67fd/attachment.html>


More information about the Tutor mailing list