Is count supposed to still work?
Mark McEahern
marklists at mceahern.com
Fri Jul 12 16:41:20 EDT 2002
> 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