Simon Schuster wrote: > I'm new to python, and almost new to programming in general. I'm at > http://www.pasteur.fr/formation/infobio/python/ch04.html in that > tutorial, and my 'count' function (if it's called a function?) isn't > working suddenly. > > >>> x = "fljshfjh" > >>> x > 'fljshfjh' > >>> count(x, 'h') > Traceback (most recent call last): > File "<stdin>", line 1, in ? > NameError: name 'count' is not defined > > I'm not sure what changed, because it used to work. anyhow thanks a lot! >
Probably because you omiitted the line from string import * However IMHO your use of a tutorial which: (1) introduces "from some_module import *" as though it is the normal way of doing things From chapter 1: """ Some magical stuff, that will be explained later: >>> from string import * """ That's *bad* magic (2) is still using (outdated) functions in the string module instead of teaching string methods should be discontinued immediately. You may wish to have a look at some of the /other/ tutorials mentioned on this page: http://wiki.python.org/moin/BeginnersGuide/NonProgrammers HTH, John -- http://mail.python.org/mailman/listinfo/python-list