I thought that the '.py ' in this import statement would make the interpreter think that newline was a package and therefore try to recognize py as a module in the newline package.
from newline.py import newline Perhaps you said this to help explain what's going on? Jacob Schmidt > > If so that is the problem. You cannot call newLine() in a separate > file from the one where you defined it - python doesn't know about it. > You need to *import* the file where you defined the function, like > this: > > from newline.py import newline > > Ah, but reading further in your post and looking at the tutorial text > you posted, the author does NOT say create a new file. Rather > he (she?) says (or implies) to just keep on typing the program > after the function definition in the same file. That way Python > can read the file including the newline() definition. > > HTH, > > Alan G. > > > ========================== > > The first couple of functions we are going to write have no > parameters, so the syntax looks like this: > > def newLine(): > print > > This function is named newLine. The empty parentheses indicate that it > has no parameters. It contains only a single statement, which outputs > a newline character. (That's what happens when you use a printcommand > without any arguments.) > > The syntax for calling the new function is the same as the syntax for > built-in functions: > > print "First Line." > newLine() > print "Second Line." > > <AG - See, no mention of creating a new file after the function > definition> > > > _______________________________________________ > Tutor maillist - [EMAIL PROTECTED] > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor
