python-like style

Fredrik Lundh fredrik at pythonware.com
Wed Aug 21 12:27:31 EDT 2002


Giorgi Lekishvili wrote:

> Here comes, what I was trying to do.

> >>>f=open(fn, 'r')
> >>>i=iter(f)
> >>>def getit(it, kw):
> ...     if string.find(it, kw)>0:
> ...         return it.next()
> ...     else:
> ...         return 0
> >>>kw='<'
> >>>rz=filter(None, map(apply(getit, s, kw), i))
>
> No, the traceback:
> File "D:\Python22\wxPython\tools\boa\ExternalLib\PythonInterpreter.py",
> line 65, in push
>     exec code in self.locals
>   File "<console>", line 1, in ?
> exceptions.NameError : name 's' is not defined

you never define anything called "s" in your script, so it's
not that strange that python cannot find it.

</F>





More information about the Python-list mailing list