Need help with string method

jvanar1 at my-deja.com jvanar1 at my-deja.com
Fri Dec 29 11:48:34 EST 2000


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'

Am I missing an 'import' somewhere.  Thanks for any help...
-Jim



Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list