Need help with string method
jvanar1 at my-deja.com
jvanar1 at my-deja.com
Fri Dec 29 12:51:03 EST 2000
Right on the money.
#!/usr/local/bin/python2.0 cleans me right up , thanks a million...
-Jim
In article <slrn94pgo7.jbc.scarblac at pino.selwerd.nl>,
scarblac at pino.selwerd.nl wrote:
> jvanar1 at my-deja.com <jvanar1 at my-deja.com> wrote in comp.lang.python:
> > I have a pretty dumb question here. I can't seem to get any string
> > methods working from *within* a script. here is a super-simple
example
> > that yields an error
> >
> > >>import sys
> > >>import string
> > >>theString = 'This is a string'
> > >>print theString.find('string')
> >
> > now this works fine from the python command line but gives an error
> > when run as a script. Here is the error message:
> >
> > Traceback (innermost last):
> > File "./clean", line 18, in ?
> > print theString.find('string')
> > AttributeError: 'string' object has no attribute 'find'
>
> Version mismatch. I think you tried it with a 2.0 command line but the
> script invokes the 1.5.2 interpreter (or similar). Try printing
sys.version
> from the script, and check the #! line (if it's on unix).
>
> --
> Remco Gerlich
>
Sent via Deja.com
http://www.deja.com/
More information about the Python-list
mailing list