Super-newbie syntax error question

Charlie Wood cwood at austin.rr.com
Sun Apr 28 22:50:26 EDT 2002


I found the error. It was a space/tab issue with my text editor.

"Sean 'Shaleh' Perry" <shalehperry at attbi.com> wrote in message
news:mailman.1020045350.28826.python-list at python.org...
> >
> >     f = file("/article.txt", "w")
> >     f.write('Category: %s\nTitle: %s\nDescription: %s\nLink: %s\n\n' %
> >       (self._category, self._title, self._descr, self._link))
> >     f.close()
> >
> >                 self._title = None
> >                 self._link = None
> >                 self._descr = ""
> >                 self._category = ""
> >
> >
> >
> > ...and here's the resulting error:
> >
> >
> >
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> >   File "C:\PYTHON22\lib\rss2html.py", line 46
> >     f = file("/article.txt", "w")
> >     ^
> > SyntaxError: invalid syntax
> >
>
> Should be:
>
> f = open() not file().
>
>





More information about the Python-list mailing list