On 21/02/06, Ara Kooser <[EMAIL PROTECTED]> wrote: > Why is that? I thought that adding , after the print command would allow > the format to stay the same. Is there a better way of doing this (I like > lists because I can edit them easily)? Thanks.
A comma after a print statement basically replaces the newline with a space. Originally, I guess, this was just so that you could say 'print x, y, z'. >>> print 'foo', 'bar', 'baz' foo bar baz But it means you can also use a trailing comma to suppress the final newline. eg: >>> def p(): ... print 'foo' ... print 'bar' ... print 'baz' ... >>> def q(): ... print 'foo', ... print 'bar', ... print 'baz' ... >>> p() foo bar baz >>> q() foo bar baz As to formatting your list --- what exactly are you trying to achieve? -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor