problem while going through a tutorial

S

Simon Schuster

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.
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!

chris
 
G

Guest

Simon Schuster schrieb:
[..]
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!

You forgot to import the string module:
from string import *

Regards,
Ralf Schoenian
 
J

John Machin

Simon said:
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.

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: """

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top