>>> import string
>>> s = 'happy cat'
>>> string.find(s, 'cat')
6
and
>>> s = 'happy cat'
>>> s.find('cat')
6
In the above 2 pieces of code, i have the following doubts.
- Why is the 2nd code working without import the string module?
- Is there any performance improvement in using one over the other?
Thanks, Vinay