Is count supposed to still work?

David LeBlanc whisper at oz.net
Fri Jul 12 16:49:49 EDT 2002


<faceslap target='self'/>No! I'd never ever do anything like that! :o)

Aren't these all built in anyway? I don't recall having to do it for
len(mystring).

David LeBlanc
Seattle, WA USA

> -----Original Message-----
> From: Mark McEahern [mailto:marklists at mceahern.com]
> Sent: Friday, July 12, 2002 13:41
> To: David LeBlanc; Python-List at Python. Org
> Subject: RE: Is count supposed to still work?
>
>
> > Whether or not you explicitly import string,
> > 	count(mystring, substring)
> > isn't working ("NameError: global name 'count' is not defined")
>
> You wouldn't perhaps be making this mistake I occasionally make,
> would you?
>
>   import foo
>   x = bar()  # forgetting to say foo.bar()
>
> >From what I can see, count works:
>
>   $ python
>   Python 2.2.1 (#1, Jun 25 2002, 10:55:46)
>   [GCC 2.95.3-5 (cygwin special)] on cygwin
>   Type "help", "copyright", "credits" or "license" for more information.
>   >>> import string
>   >>> string.count("foo", "bar")
>   0
>
> Cheers,
>
> // mark
> -
>






More information about the Python-list mailing list