Why 'string' functions i.e. rstrip, upper, lower are 'not found'.........

Michael Hudson mwh at python.net
Thu Dec 4 11:40:38 EST 2003


John_Dutcher at urmc.rochester.edu (John F Dutcher) writes:

> There must be a 'fundamental' reason why 'string' functions are
> reported as 'not found' even though the 'import string' statement
> is present. If the script has user-defined functions at its beginning
> and I remove them...doing all code inline, the 'not found' error goes away.
> Is there some 'placement of user functions' issue that explains why
> the 'import string' doesn't make the various string functions visible
> when I use various 'def userfunc's in the script ??

If you do 

>>> import string

to get at, eg, maketrans, you need to do

>>> string.maketrans

Cheers,
mwh

-- 
  One of the great skills in using any language is knowing what not
  to use, what not to say.  ... There's that simplicity thing again.
                                                       -- Ron Jeffries




More information about the Python-list mailing list