jpeng at block.duxieweb.com
Tue Jan 22 06:37:43 CET 2008
Gabriel Genellina 写道:
> En Tue, 22 Jan 2008 02:03:10 -0200, Paul Rubin
> <"http://phr.cx"@NOSPAM.invalid> escribió:
>> "J. Peng" <jpeng at block.duxieweb.com> writes:
>>> print line,
>> Do you really want all the lines crunched together like that? If not,
>> leave off the comma.
> Remember that Python *keeps* the end-of-line charater at the end of each
> line; if you leave out the comma, you'll print them doubly spaced.
Most languages (AFAIK) keep the newline character at the end of lines
when reading from a file.But python's difference is its 'print' built-in
function add a newline automatically for you. So without that ',' we
will get double newlines.
More information about the Python-list